From: Andrew Morton <akpm@linux-foundation.org>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
Robin Getz <rgetz@blackfin.uclinux.org>,
stable@kernel.org
Subject: Re: [PATCH] NOMMU: Don't pass NULL pointers to fput() in do_mmap_pgoff()
Date: Fri, 30 Oct 2009 14:22:01 -0700 [thread overview]
Message-ID: <20091030142201.29a492e9.akpm@linux-foundation.org> (raw)
In-Reply-To: <20091030131326.5891.68842.stgit@warthog.procyon.org.uk>
On Fri, 30 Oct 2009 13:13:26 +0000
David Howells <dhowells@redhat.com> wrote:
> 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>
> ---
>
> mm/nommu.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
>
> diff --git a/mm/nommu.c b/mm/nommu.c
> index cfea46c..969392c 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -1364,9 +1364,11 @@ share:
> error_just_free:
> up_write(&nommu_region_sem);
> error:
> - fput(region->vm_file);
> + if (region->vm_file)
> + fput(region->vm_file);
> kmem_cache_free(vm_region_jar, region);
> - fput(vma->vm_file);
> + if (vma->vm_file)
> + fput(vma->vm_file);
> if (vma->vm_flags & VM_EXECUTABLE)
> removed_exe_file_vma(vma->vm_mm);
> kmem_cache_free(vm_area_cachep, vma);
Seems like a pretty obvious -stable candidate, but no stable tag in the
changelog?
Assuming this is needed in -stable, do we know how far back in time the
bug exists?
prev parent reply other threads:[~2009-10-30 21:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-30 13:13 David Howells
2009-10-30 21:22 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091030142201.29a492e9.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rgetz@blackfin.uclinux.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®