From: Chen Gang Date: Wed, 11 Sep 2013 21:22:43 +0000 (-0700) Subject: mm/mremap.c: call pud_free() after fail calling pmd_alloc() X-Git-Tag: v3.12-rc1~52^2~181 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ecfd533f4c528b0b4cc5bc115c4c47f0b5e4828;p=profile%2Fivi%2Fkernel-x86-ivi.git mm/mremap.c: call pud_free() after fail calling pmd_alloc() In alloc_new_pmd(), if pud_alloc() was called successfully, but pmd_alloc() fails, avoid leaking `pud'. Signed-off-by: Chen Gang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mremap.c b/mm/mremap.c index 0843feb..91b13d6 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "internal.h" @@ -62,8 +63,10 @@ static pmd_t *alloc_new_pmd(struct mm_struct *mm, struct vm_area_struct *vma, return NULL; pmd = pmd_alloc(mm, pud, addr); - if (!pmd) + if (!pmd) { + pud_free(mm, pud); return NULL; + } VM_BUG_ON(pmd_trans_huge(*pmd));