提交 dcd4a049 编写于 作者: J Johannes Weiner 提交者: Linus Torvalds

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.

[akpm@linux-foundation.org: add sorely-needed comment]
Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
Reported-by: NAkinobu Mita <akinobu.mita@gmail.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 084f71ae
...@@ -2090,6 +2090,9 @@ void exit_mmap(struct mm_struct *mm) ...@@ -2090,6 +2090,9 @@ void exit_mmap(struct mm_struct *mm)
arch_exit_mmap(mm); arch_exit_mmap(mm);
mmu_notifier_release(mm); mmu_notifier_release(mm);
if (!mm->mmap) /* Can happen if dup_mmap() received an OOM */
return;
if (mm->locked_vm) { if (mm->locked_vm) {
vma = mm->mmap; vma = mm->mmap;
while (vma) { while (vma) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册