In alloc_new_pmd(), if pud_alloc() was called successfully, but pmd_alloc() is called by fail, in this case, need call pud_free() before return. Also need include "asm/pgalloc.h" which have the declaration of pud_free(), or can not pass compiling. Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx> --- mm/mremap.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index 457d34e..f37f8a0 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -24,6 +24,7 @@ #include <asm/uaccess.h> #include <asm/cacheflush.h> #include <asm/tlbflush.h> +#include <asm/pgalloc.h> #include "internal.h" @@ -61,8 +62,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)); -- 1.7.7.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>