lkml.org 
[lkml]   [2007]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH -mm] slub: update cpu after new_slab()
SLUB gave me a NULL pointer dereference in slab_alloc(), in the
slab_lock(page) of its "Current cpuslab is acceptable" block: cpu
1 had been looking at cpu_slab[2], which then went NULL beneath it.
Since new_slab() may reenable interrupts and sleep (when __GFP_WAIT),
we may get rescheduled on a different cpu: so need to reevaluate it.

Signed-off-by: Hugh Dickins <hugh@veritas.com>

--- 2.6.21-rc7-mm1/mm/slub.c 2007-04-24 20:26:48.000000000 +0100
+++ linux/mm/slub.c 2007-04-25 15:49:12.000000000 +0100
@@ -1234,11 +1234,12 @@ have_slab:

page = new_slab(s, gfpflags, node);
if (page) {
+ cpu = smp_processor_id();
if (s->cpu_slab[cpu]) {
/*
- * Someone else populated the cpu_slab while
- * we enabled interrupts. The page may not
- * be on the requested node.
+ * Someone else populated the cpu_slab while we enabled
+ * interrupts, or we have got scheduled on another cpu.
+ * The page may not be on the requested node.
*/
if (node == -1 ||
page_to_nid(s->cpu_slab[cpu]) == node) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-04-25 17:23    [W:0.083 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site