public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [to-be-updated] mm-mempolicy-fix-memory-leak-in-weighted_interleave_auto_store.patch removed from -mm tree
@ 2026-04-01  3:39 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-04-01  3:39 UTC (permalink / raw)
  To: mm-commits, stable, joshua.hahnjy, gourry, david, byungchul,
	apopple, liuyun01, akpm


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

This patch was dropped because an updated version will be issued

------------------------------------------------------
From: Jackie Liu <liuyun01@kylinos.cn>
Subject: mm/mempolicy: fix memory leak in weighted_interleave_auto_store()
Date: Tue, 31 Mar 2026 18:07:40 +0800

Add the missing kfree(new_wi_state) when the auto mode is already set to
the requested value.  When a user writes "false" to the auto sysfs
interface and the current mode is already manual (mode_auto == false), the
function returns early without freeing new_wi_state allocated at the
beginning of the function.  This can be triggered repeatedly from
userspace, leaking memory on each write.

Link: https://lkml.kernel.org/r/20260331100740.84906-1-liu.yun@linux.dev
Fixes: e341f9c3c841 ("mm/mempolicy: Weighted Interleave Auto-tuning")
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Reviewed by: Donet Tom <donettom@linux.ibm.com>
Reviewed-by: Gregory Price <gourry@gourry.net>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Byungchul Park <byungchul@sk.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/mempolicy.c |    1 +
 1 file changed, 1 insertion(+)

--- a/mm/mempolicy.c~mm-mempolicy-fix-memory-leak-in-weighted_interleave_auto_store
+++ a/mm/mempolicy.c
@@ -3707,6 +3707,7 @@ static ssize_t weighted_interleave_auto_
 			goto update_wi_state;
 		if (input == old_wi_state->mode_auto) {
 			mutex_unlock(&wi_state_lock);
+			kfree(new_wi_state);
 			return count;
 		}
 
_

Patches currently in -mm which might be from liuyun01@kylinos.cn are

mm-damon-stat-fix-memory-leak-on-damon_start-failure-in-damon_stat_start.patch
mm-mempolicy-fix-memory-leaks-in-weighted_interleave_auto_store.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-01  3:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01  3:39 [to-be-updated] mm-mempolicy-fix-memory-leak-in-weighted_interleave_auto_store.patch removed from -mm tree Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox