[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120418154448.GA3617@swordfish.minsk.epam.com>
Date: Wed, 18 Apr 2012 18:44:48 +0300
From: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
To: Catalin Marinas <catalin.marinas@....com>
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] kmemleak: do not leak object after tree insertion error (v3)
[PATCH] kmemleak: do not leak object after tree insertion error
In case when tree insertion fails due to already existing object
error, pointer to allocated object gets lost because of overwrite
with lookup_object() return. Free allocated object before object
lookup.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
---
mm/kmemleak.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 45eb621..5f05993 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -578,6 +578,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
if (node != &object->tree_node) {
kmemleak_stop("Cannot insert 0x%lx into the object search tree "
"(already existing)\n", ptr);
+ kmem_cache_free(object_cache, object);
object = lookup_object(ptr, 1);
spin_lock(&object->lock);
dump_object_info(object);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists