Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 507effea authored by Christoph Lameter's avatar Christoph Lameter Committed by Pekka Enberg
Browse files

slub: Add frozen check in __slab_alloc



Verify that objects returned from __slab_alloc come from slab pages
in the correct state.

Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
parent 6faa6833
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2245,6 +2245,12 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
	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);