Skip to contentSkip to conversation

mm-shrinker-fix-refcount-leak-in-shrink_slab_memcg.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 24

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/shrinker: fix refcount leak in shrink_slab_memcg()
has been removed from the -mm tree. Its filename was
mm-shrinker-fix-refcount-leak-in-shrink_slab_memcg.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Altan Hacigumus <[email protected]>
Subject: mm/shrinker: fix refcount leak in shrink_slab_memcg()
Date: Tue, 3 Feb 2026 19:35:53 -0800

When kmem is disabled for memcg, slab-backed shrinkers are skipped. However, shrink_slab_memcg() doesn't drop the reference acquired via shrinker_try_get() before continuing.

Add the missing shrinker_put().

Also, since memcg_kmem_online() and shrinker flags cannot change dynamically, remove the shrinker from the bitmap to avoid unnecessary future scans.

---

 mm/shrinker.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
mm/shrinker.c renamed from mm/shrinker.c~mm-shrinker-fix-refcount-leak-in-shrink_slab_memcg +4 -1
@@ -544,8 +544,11 @@ again:
 
 			/* Call non-slab shrinkers even though kmem is disabled */
 			if (!memcg_kmem_online() &&
-			    !(shrinker->flags & SHRINKER_NONSLAB))
+			    !(shrinker->flags & SHRINKER_NONSLAB)) {
+				clear_bit(offset, unit->map);
+				shrinker_put(shrinker);
 				continue;
+			}
 
 			ret = do_shrink_slab(&sc, shrinker, priority);
 			if (ret == SHRINK_EMPTY) {

_

Patches currently in -mm which might be from [email protected] are