[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1386495533-413-1-git-send-email-ethan.kernel@gmail.com>
Date: Sun, 8 Dec 2013 17:38:53 +0800
From: "ethan.zhao" <ethan.kernel@...il.com>
To: hristoph@...eter.com, alokk@...softinc.com, shobhit@...softinc.com,
shai@...lex86.org, cl@...ux.com
Cc: linux-kernel@...r.kernel.org, "ethan.zhao" <ethan.kernel@...il.com>
Subject: [PATCH] mm/slab.c: check pointer slabp before using it in alloc_slabmgmt()
Move the NULL check of slabp to the right place before refer its memeber in
function alloc_slabmgmt().
This bug may be introduced by rewriting of funcion kmemleak_scan_area(),
the first parameter changed from slabp to &slabp->list.
Signed-off-by: ethan.zhao <ethan.kernel@...il.com>
---
mm/slab.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 2580db0..b6d27bc 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2612,6 +2612,8 @@ static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, void *objp,
/* Slab management obj is off-slab. */
slabp = kmem_cache_alloc_node(cachep->slabp_cache,
local_flags, nodeid);
+ if (!slabp)
+ return NULL;
/*
* If the first object in the slab is leaked (it's allocated
* but no one has a reference to it), we want to make sure
@@ -2620,8 +2622,6 @@ static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, void *objp,
*/
kmemleak_scan_area(&slabp->list, sizeof(struct list_head),
local_flags);
- if (!slabp)
- return NULL;
} else {
slabp = objp + colour_off;
colour_off += cachep->slab_size;
--
1.8.3.4 (Apple Git-47)
--
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