]> git.baikalelectronics.ru Git - kernel.git/commit
NOMMU: Don't pass NULL pointers to fput() in do_mmap_pgoff()
authorDavid Howells <dhowells@redhat.com>
Fri, 30 Oct 2009 13:13:26 +0000 (13:13 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 31 Oct 2009 19:11:37 +0000 (12:11 -0700)
commit5ef3d7db3a736f4fc8f4f873e465cee43689611b
treec768adbc88d0482d4fdd0ff8385fe77c01ae1534
parente5a4d6cf165f342eecfec3658b62c47018c4711f
NOMMU: Don't pass NULL pointers to fput() in do_mmap_pgoff()

Don't pass NULL pointers to fput() in the error handling paths of the NOMMU
do_mmap_pgoff() as it can't handle it.

The following can be used as a test program:

int main() { static long long a[1024 * 1024 * 20] = { 0 }; return a;}

Without the patch, the code oopses in atomic_long_dec_and_test() as called by
fput() after the kernel complains that it can't allocate that big a chunk of
memory.  With the patch, the kernel just complains about the allocation size
and then the program segfaults during execve() as execve() can't complete the
allocation of all the new ELF program segments.

Reported-by: Robin Getz <rgetz@blackfin.uclinux.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Robin Getz <rgetz@blackfin.uclinux.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/nommu.c