Commit 9b9e4370 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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()
parents 8b4a014e cbcff934
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -6336,8 +6336,6 @@ static void free_to_pcs_bulk(struct kmem_cache *s, size_t size, void **p)

		if (unlikely(!slab_free_hook(s, p[i], init, false))) {
			p[i] = p[--size];
			if (!size)
				goto flush_remote;
			continue;
		}

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

	if (!size)
		goto flush_remote;

next_batch:
	if (!local_trylock(&s->cpu_sheaves->lock))
		goto fallback;
@@ -6406,6 +6407,9 @@ static void free_to_pcs_bulk(struct kmem_cache *s, size_t size, void **p)
		goto next_batch;
	}

	if (remote_nr)
		goto flush_remote;

	return;

no_empty: