Skip to contentSkip to conversation

Patch "parisc: mm: Fix a memory leak related to pmd not attached to the pgd" has been added to the 4.1-stable tree

PATCH [email protected] 1 participant 1 message Aug 6, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

parisc: mm: Fix a memory leak related to pmd not attached to the pgd

to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
parisc-mm-fix-a-memory-leak-related-to-pmd-not-attached-to-the-pgd.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 4c4ac9a48ac512c6b5a6cca06cfad2ad96e8caaa Mon Sep 17 00:00:00 2001

From: Christophe Jaillet <[email protected]>
Date: Mon, 13 Jul 2015 11:32:43 +0200
Subject: parisc: mm: Fix a memory leak related to pmd not attached to the pgd

From: Christophe Jaillet <[email protected]>

commit 4c4ac9a48ac512c6b5a6cca06cfad2ad96e8caaa upstream.

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.

---
 arch/parisc/include/asm/pgalloc.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/parisc/include/asm/pgalloc.h +2 -1
@@ -72,7 +72,7 @@ static inline pmd_t *pmd_alloc_one(struc
 
 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_st
 		 */
 		mm_inc_nr_pmds(mm);
 		return;
+	}
 	free_pages((unsigned long)pmd, PMD_ORDER);
 }
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.1/parisc-mm-fix-a-memory-leak-related-to-pmd-not-attached-to-the-pgd.patch