[PATCH] mmaper_kern.c fixes [buffer overruns]
Al Viro authored
- 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: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
6a029a90
Name Last commit Last update
..
alpha [PATCH] alpha spinlock code and bogus constraints
arm [PATCH] arm: fix IXP4xx flash resource range
arm26 It wasn't just x86-64 that had hardcoded VM_FAULT_xxx numbers
cris It wasn't just x86-64 that had hardcoded VM_FAULT_xxx numbers
frv It wasn't just x86-64 that had hardcoded VM_FAULT_xxx numbers
h8300 [PATCH] Don't export machine_restart, machine_halt, or machine_power_off.
i386 [PATCH] i386: fix incorrect FP signal code
ia64 [PATCH] Export pcibios_bus_to_resource
m32r [PATCH] missing exports on m32r
m68k It wasn't just x86-64 that had hardcoded VM_FAULT_xxx numbers
m68knommu [PATCH] Don't export machine_restart, machine_halt, or machine_power_off.
mips [PATCH] mips: remove obsolete GIU driver for vr41xx
parisc It wasn't just x86-64 that had hardcoded VM_FAULT_xxx numbers
ppc [PATCH] ppc32 8xx: fix m8xx_ide_init() #ifdef
ppc64 [PATCH] ppc64: Export machine_power_off for therm_pm72 module
s390 [PATCH] broken inline asm on s390 (misuse of labels)
sh [PATCH] SH: inotify and ioprio syscalls
sh64 [PATCH] SH64: inotify and ioprio syscalls
sparc [SPARC]: Fix weak aliases
sparc64 [PATCH] Export pcibios_bus_to_resource
um [PATCH] mmaper_kern.c fixes [buffer overruns]
v850 [PATCH] v850: Update PCI support
x86_64 [PATCH] x86_64: Tell VM about holes in nodes
xtensa [PATCH] xtensa: use ssleep() instead of schedule_timeout()