* [PATCH] mm/mremap.c: call pud_free() after fail calling pmd_alloc()
@ 2013-08-20 3:27 Chen Gang
0 siblings, 0 replies; only message in thread
From: Chen Gang @ 2013-08-20 3:27 UTC (permalink / raw)
To: Michel Lespinasse, riel, Ingo Molnar, linux; +Cc: Andrew Morton, linux-mm
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@asianux.com>
---
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@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>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-08-20 3:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-20 3:27 [PATCH] mm/mremap.c: call pud_free() after fail calling pmd_alloc() Chen Gang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox