Skip to content

Commit a80abfb

Browse files
committed
Merge tag 'slab-for-6.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab
Pull slab fix from Vlastimil Babka: - Fix for potential infinite loop in kmalloc_nolock() when debugging is enabled for the cache (Vlastimil Babka) * tag 'slab-for-6.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab: slab: prevent infinite loop in kmalloc_nolock() with debugging
2 parents 9dc5206 + c379b74 commit a80abfb

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mm/slub.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4666,8 +4666,12 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
46664666
if (kmem_cache_debug(s)) {
46674667
freelist = alloc_single_from_new_slab(s, slab, orig_size, gfpflags);
46684668

4669-
if (unlikely(!freelist))
4669+
if (unlikely(!freelist)) {
4670+
/* This could cause an endless loop. Fail instead. */
4671+
if (!allow_spin)
4672+
return NULL;
46704673
goto new_objects;
4674+
}
46714675

46724676
if (s->flags & SLAB_STORE_USER)
46734677
set_track(s, freelist, TRACK_ALLOC, addr,

0 commit comments

Comments
 (0)