mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/pat: fix memory leak in free_memtype
@ 2010-05-25  9:52 Xiaotian Feng
  2010-05-26  0:12 ` Suresh Siddha
  0 siblings, 1 reply; 6+ messages in thread
From: Xiaotian Feng @ 2010-05-25  9:52 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, Xiaotian Feng, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, Venkatesh Pallipadi, Jack Steiner, Suresh Siddha

reserve_memtype will allocate memory for new memtype, but
in free_memtype, after the memtype erased from rbtree, the
memory is not freed.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
---
 arch/x86/mm/pat_rbtree.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/mm/pat_rbtree.c b/arch/x86/mm/pat_rbtree.c
index 07de4cb..fb8c1e5 100644
--- a/arch/x86/mm/pat_rbtree.c
+++ b/arch/x86/mm/pat_rbtree.c
@@ -15,6 +15,7 @@
 #include <linux/rbtree.h>
 #include <linux/sched.h>
 #include <linux/gfp.h>
+#include <linux/slab.h>
 
 #include <asm/pgtable.h>
 #include <asm/pat.h>
@@ -240,6 +241,7 @@ int rbt_memtype_erase(u64 start, u64 end)
 		return -EINVAL;
 
 	rb_erase(&data->rb, &memtype_rbroot);
+	kfree(data);
 	return 0;
 }
 
-- 
1.7.0.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-05-26 20:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-25  9:52 [PATCH] x86/pat: fix memory leak in free_memtype Xiaotian Feng
2010-05-26  0:12 ` Suresh Siddha
2010-05-26  0:27   ` Suresh Siddha
2010-05-26  1:51   ` [PATCH V2] " Xiaotian Feng
2010-05-26 16:47     ` Suresh Siddha
2010-05-26 20:22     ` [tip:x86/urgent] x86, pat: Fix " tip-bot for Xiaotian Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®