slub: Fix slub_lock down/up imbalance
authorPavel Emelyanov <xemul@parallels.com>
Thu, 28 Oct 2010 09:50:37 +0000 (13:50 +0400)
committerPekka Enberg <penberg@kernel.org>
Sat, 6 Nov 2010 07:04:33 +0000 (09:04 +0200)
There are two places, that do not release the slub_lock.

Respective bugs were introduced by sysfs changes ab4d5ed5 (slub: Enable
sysfs support for !CONFIG_SLUB_DEBUG) and 2bce6485 ( slub: Allow removal
of slab caches during boot).

Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
mm/slub.c

index 7e657aa19475ccb21cea26544282bd702e7651c8..7796a0446b3f28fce176dac24270f1d89cb160fc 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3289,9 +3289,9 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
                kfree(n);
                kfree(s);
        }
+err:
        up_write(&slub_lock);
 
-err:
        if (flags & SLAB_PANIC)
                panic("Cannot create slabcache %s\n", name);
        else
@@ -3878,6 +3878,7 @@ static ssize_t show_slab_objects(struct kmem_cache *s,
                        x += sprintf(buf + x, " N%d=%lu",
                                        node, nodes[node]);
 #endif
+       up_read(&slub_lock);
        kfree(nodes);
        return x + sprintf(buf + x, "\n");
 }
This page took 0.031899 seconds and 5 git commands to generate.