Skip to content

Commit 9b9e437

Browse files
committed
Merge tag 'slab-for-6.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab
Pull slab fix from Vlastimil Babka: - Fix memory leak of objects from remote NUMA node when bulk freeing to a cache with sheaves (Harry Yoo) * tag 'slab-for-6.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab: mm/slub: fix memory leak in free_to_pcs_bulk()
2 parents 8b4a014 + cbcff93 commit 9b9e437

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

mm/slub.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6336,8 +6336,6 @@ static void free_to_pcs_bulk(struct kmem_cache *s, size_t size, void **p)
63366336

63376337
if (unlikely(!slab_free_hook(s, p[i], init, false))) {
63386338
p[i] = p[--size];
6339-
if (!size)
6340-
goto flush_remote;
63416339
continue;
63426340
}
63436341

@@ -6352,6 +6350,9 @@ static void free_to_pcs_bulk(struct kmem_cache *s, size_t size, void **p)
63526350
i++;
63536351
}
63546352

6353+
if (!size)
6354+
goto flush_remote;
6355+
63556356
next_batch:
63566357
if (!local_trylock(&s->cpu_sheaves->lock))
63576358
goto fallback;
@@ -6406,6 +6407,9 @@ static void free_to_pcs_bulk(struct kmem_cache *s, size_t size, void **p)
64066407
goto next_batch;
64076408
}
64086409

6410+
if (remote_nr)
6411+
goto flush_remote;
6412+
64096413
return;
64106414

64116415
no_empty:

0 commit comments

Comments
 (0)