Skip to content

Commit 959f018

Browse files
committed
Merge tag 'slab-for-6.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab
Pull slab fixes from Vlastimil Babka: - Fixes for two bugs that can be triggered when debugging options are enabled (Hao Ge, Vlastimil Babka) * tag 'slab-for-6.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab: slab: reset slab->obj_ext when freeing and it is OBJEXTS_ALLOC_FAIL slab: fix clearing freelist in free_deferred_objects()
2 parents f406055 + 86f54f9 commit 959f018

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

mm/slub.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,8 +2170,15 @@ static inline void free_slab_obj_exts(struct slab *slab)
21702170
struct slabobj_ext *obj_exts;
21712171

21722172
obj_exts = slab_obj_exts(slab);
2173-
if (!obj_exts)
2173+
if (!obj_exts) {
2174+
/*
2175+
* If obj_exts allocation failed, slab->obj_exts is set to
2176+
* OBJEXTS_ALLOC_FAIL. In this case, we end up here and should
2177+
* clear the flag.
2178+
*/
2179+
slab->obj_exts = 0;
21742180
return;
2181+
}
21752182

21762183
/*
21772184
* obj_exts was created with __GFP_NO_OBJ_EXT flag, therefore its
@@ -6443,15 +6450,16 @@ static void free_deferred_objects(struct irq_work *work)
64436450
slab = virt_to_slab(x);
64446451
s = slab->slab_cache;
64456452

6453+
/* Point 'x' back to the beginning of allocated object */
6454+
x -= s->offset;
6455+
64466456
/*
64476457
* We used freepointer in 'x' to link 'x' into df->objects.
64486458
* Clear it to NULL to avoid false positive detection
64496459
* of "Freepointer corruption".
64506460
*/
6451-
*(void **)x = NULL;
6461+
set_freepointer(s, x, NULL);
64526462

6453-
/* Point 'x' back to the beginning of allocated object */
6454-
x -= s->offset;
64556463
__slab_free(s, slab, x, x, 1, _THIS_IP_);
64566464
}
64576465

0 commit comments

Comments
 (0)