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
Unified · Split
| @@ -4666,8 +4666,12 @@ new_objects: · 4665 unmodified lines | |||
| 4666 | if (kmem_cache_debug(s)) { | 4666 | if (kmem_cache_debug(s)) { |
| 4667 | freelist = alloc_single_from_new_slab(s, slab, orig_size, gfpflags); | 4667 | freelist = alloc_single_from_new_slab(s, slab, orig_size, gfpflags); |
| 4668 | 4668 | ||
| 4669 | if (unlikely(!freelist)) | 4669 | if (unlikely(!freelist)) { |
| 4670 | /* This could cause an endless loop. Fail instead. */ | ||
| 4671 | if (!allow_spin) | ||
| 4672 | return NULL; | ||
| 4670 | goto new_objects; | 4673 | goto new_objects; |
| 4674 | } | ||
| 4671 | 4675 | ||
| 4672 | if (s->flags & SLAB_STORE_USER) | 4676 | if (s->flags & SLAB_STORE_USER) |
| 4673 | set_track(s, freelist, TRACK_ALLOC, addr, | 4677 | set_track(s, freelist, TRACK_ALLOC, addr, |