]> git.karo-electronics.de Git - karo-tx-linux.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)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Nov 2009 00:22:33 +0000 (16:22 -0800)
commitcd4ad4b9dda686bce57f939671cc066a554b7f92
tree00f2b3fb6d04e83fb6144d0b3f1f866cd767d014
parent7af6e31fc7ab7235ae38be7847f346d8d776389d
NOMMU: Don't pass NULL pointers to fput() in do_mmap_pgoff()

commit 89a8640279f8bb78aaf778d1fc5c4a6778f18064 upstream.

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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
mm/nommu.c