Skip to content

Commit a54f4a9

Browse files
committed
Merge tag 'slab-for-6.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab
Pull slab fix from Vlastimil Babka: - Stable fix adding zero initialization of slab->obj_ext to prevent crashes with allocation profiling (Suren Baghdasaryan) * tag 'slab-for-6.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab: slab: ensure slab->obj_exts is clear in a newly allocated slab page
2 parents cfb2e2c + d2f5819 commit a54f4a9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mm/slub.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,6 +1973,11 @@ static inline void handle_failed_objexts_alloc(unsigned long obj_exts,
19731973
#define OBJCGS_CLEAR_MASK (__GFP_DMA | __GFP_RECLAIMABLE | \
19741974
__GFP_ACCOUNT | __GFP_NOFAIL)
19751975

1976+
static inline void init_slab_obj_exts(struct slab *slab)
1977+
{
1978+
slab->obj_exts = 0;
1979+
}
1980+
19761981
int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s,
19771982
gfp_t gfp, bool new_slab)
19781983
{
@@ -2058,6 +2063,10 @@ static inline bool need_slab_obj_ext(void)
20582063

20592064
#else /* CONFIG_SLAB_OBJ_EXT */
20602065

2066+
static inline void init_slab_obj_exts(struct slab *slab)
2067+
{
2068+
}
2069+
20612070
static int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s,
20622071
gfp_t gfp, bool new_slab)
20632072
{
@@ -2637,6 +2646,7 @@ static struct slab *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
26372646
slab->objects = oo_objects(oo);
26382647
slab->inuse = 0;
26392648
slab->frozen = 0;
2649+
init_slab_obj_exts(slab);
26402650

26412651
account_slab(slab, oo_order(oo), s, flags);
26422652

0 commit comments

Comments
 (0)