diff options
| author | Chen Gang <gang.chen@asianux.com> | 2013-09-11 17:22:43 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:58:03 -0400 |
| commit | 1ecfd533f4c528b0b4cc5bc115c4c47f0b5e4828 (patch) | |
| tree | 5eb1a6053fe7999323ed7238e6cb4993652b05c5 | |
| parent | 762216ab4e175f49d17bc7ad778c57b9028184e6 (diff) | |
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 <gang.chen@asianux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | mm/mremap.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/mremap.c b/mm/mremap.c index 0843feb66f3d..91b13d6a16d4 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
| 26 | #include <asm/cacheflush.h> | 26 | #include <asm/cacheflush.h> |
| 27 | #include <asm/tlbflush.h> | 27 | #include <asm/tlbflush.h> |
| 28 | #include <asm/pgalloc.h> | ||
| 28 | 29 | ||
| 29 | #include "internal.h" | 30 | #include "internal.h" |
| 30 | 31 | ||
| @@ -62,8 +63,10 @@ static pmd_t *alloc_new_pmd(struct mm_struct *mm, struct vm_area_struct *vma, | |||
| 62 | return NULL; | 63 | return NULL; |
| 63 | 64 | ||
| 64 | pmd = pmd_alloc(mm, pud, addr); | 65 | pmd = pmd_alloc(mm, pud, addr); |
| 65 | if (!pmd) | 66 | if (!pmd) { |
| 67 | pud_free(mm, pud); | ||
| 66 | return NULL; | 68 | return NULL; |
| 69 | } | ||
| 67 | 70 | ||
| 68 | VM_BUG_ON(pmd_trans_huge(*pmd)); | 71 | VM_BUG_ON(pmd_trans_huge(*pmd)); |
| 69 | 72 | ||
