https://github.com/torvalds/linux
Revision 6a029a90f5b93e2b50bcbbaef05ef91fa0c1d6b3 authored by Al Viro on 27 August 2005, 05:48:15 UTC, committed by Linus Torvalds on 27 August 2005, 17:11:40 UTC
 - copy_from_user() can fail; ->write() must check its return value.

 - severe buffer overruns both in ->read() and ->write() - lseek to the
   end (i.e.  to mmapper_size) and

	if (count + *ppos > mmapper_size)
		count = count + *ppos - mmapper_size;

   will do absolutely nothing.  Then it will call

	copy_to_user(buf,&v_buf[*ppos],count);

   with obvious results (similar for ->write()).

   Fixed by turning read to simple_read_from_buffer() and by doing
   normal limiting of count in ->write().

 - gratitious lock_kernel() in ->mmap() - it's useless there.

 - lots of gratuitous includes.

Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 36676bc
History
Tip revision: 6a029a90f5b93e2b50bcbbaef05ef91fa0c1d6b3 authored by Al Viro on 27 August 2005, 05:48:15 UTC
[PATCH] mmaper_kern.c fixes [buffer overruns]
Tip revision: 6a029a9

README

back to top