[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <961aa3350812231422u39adc12dna71060186f9026e0@mail.gmail.com>
Date: Wed, 24 Dec 2008 07:22:31 +0900
From: "Akinobu Mita" <akinobu.mita@...il.com>
To: "Johannes Weiner" <hannes@...xchg.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
akpm@...ux-foundation.org
Subject: Re: [PATCH] fix unmap_vmas() with NULL vma
> 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@...xchg.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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists