path: root/arch
diff options
authorChristophe Jaillet <>2015-07-13 11:32:43 +0200
committerHelge Deller <>2015-07-19 08:56:14 +0200
commit4c4ac9a48ac512c6b5a6cca06cfad2ad96e8caaa (patch)
tree7e721e9391aafea6b902fb25d65ce967d910c35e /arch
parent9d37e6679dfddbb5fa605fb2d7ff448f7cd6d038 (diff)
parisc: mm: Fix a memory leak related to pmd not attached to the pgd
Commit 0e0da48dee8d ("parisc: mm: don't count preallocated pmds") introduced a memory leak. After this commit, the 'return' statement in pmd_free is executed in all cases. Even for pmd that are not attached to the pgd. So 'free_pages' can never be called anymore, leading to a memory leak. Signed-off-by: Christophe JAILLET <> Acked-by: Kirill A. Shutemov <> Acked-by: Mikulas Patocka <> Acked-by: Helge Deller <> Cc: # v4.0+ Signed-off-by: Helge Deller <>
Diffstat (limited to 'arch')
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
index 3a08eae3318f..3edbb9fc91b4 100644
--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
@@ -72,7 +72,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
- if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
+ if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) {
* This is the permanent pmd attached to the pgd;
* cannot free it.
@@ -81,6 +81,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
+ }
free_pages((unsigned long)pmd, PMD_ORDER);