From: "Akinobu Mita" <akinobu.mita@gmail.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
akpm@linux-foundation.org
Subject: Re: [PATCH] fix unmap_vmas() with NULL vma
Date: Wed, 24 Dec 2008 07:22:31 +0900 [thread overview]
Message-ID: <961aa3350812231422u39adc12dna71060186f9026e0@mail.gmail.com> (raw)
In-Reply-To: <20081223150618.GB3215@cmpxchg.org>
> Why bail out this late? We can save the other stuff in exit_mmap() as
> well if we have no mmaps.
>
> Granted, the path is dead cold so the extra call overhead doesn't
> matter but I think the check is logically better placed in
> exit_mmap().
Looks good, this patch should go in.
> Hannes
>
> ---
> Subject: mm: check for no mmaps in exit_mmap()
>
> When dup_mmap() ooms we can end up with mm->mmap == NULL. The error
> path does mmput() and unmap_vmas() gets a NULL vma which it
> dereferences.
>
> In exit_mmap() there is nothing to do at all for this case, we can
> cancel the callpath right there.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index d4855a6..b9d1636 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2091,6 +2091,9 @@ void exit_mmap(struct mm_struct *mm)
> arch_exit_mmap(mm);
> mmu_notifier_release(mm);
>
> + if (!mm->mmap)
> + return;
> +
> if (mm->locked_vm) {
> vma = mm->mmap;
> while (vma) {
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2008-12-23 22:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-23 10:38 Akinobu Mita
2008-12-23 15:06 ` Johannes Weiner
2008-12-23 22:22 ` Akinobu Mita [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=961aa3350812231422u39adc12dna71060186f9026e0@mail.gmail.com \
--to=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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