slub: Add frozen check in __slab_alloc
authorChristoph Lameter <cl@linux.com>
Wed, 9 May 2012 15:09:52 +0000 (10:09 -0500)
committerPekka Enberg <penberg@kernel.org>
Fri, 1 Jun 2012 06:25:40 +0000 (09:25 +0300)
Verify that objects returned from __slab_alloc come from slab pages
in the correct state.

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

index 83f2582..a3395c2 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2245,6 +2245,12 @@ redo:
        stat(s, ALLOC_REFILL);
 
 load_freelist:
+       /*
+        * freelist is pointing to the list of objects to be used.
+        * page is pointing to the page from which the objects are obtained.
+        * That page must be frozen for per cpu allocations to work.
+        */
+       VM_BUG_ON(!c->page->frozen);
        c->freelist = get_freepointer(s, freelist);
        c->tid = next_tid(c->tid);
        local_irq_restore(flags);