From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D388260580; Thu, 28 May 2026 20:15:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779999328; cv=none; b=kAIfeAo+ijXXjgdGN/FIVkA6u2JT1pvB18H+F6j6q45yoeJgDTOfsRbVD2fpnJXeaaRoVv6LEZU2cjOiiemkdFtW7sK1cCdwbSmBT4cYKcdL4+S32dRql03V8IjCxGAYq7hhcljADtAMud/h7ksjsbmpAdvLmf55NwMspKWC3Hg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779999328; c=relaxed/simple; bh=BCDqs1RoUYTF2kfBoAv92ElTtmWtZnkTuCZhVj50ezA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uT9WCu0o6sYf3XxslMX9KhxL67SpcH+Rf5S+erArWHxWohQddZyBNhGOqfZJOkL431hVPOAnZeFzi5jau9OP+SV8OuRQf5q+wOJ53Wuy6BomYF1+8vT+gphv31MoDybAqMh2mPRFzT9og1moTXYIOn8T4nBQyA3kgYoQYpdtTlc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DLLb6PDl; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DLLb6PDl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA5441F000E9; Thu, 28 May 2026 20:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779999327; bh=YC3sJvWfNUKkSPkzgB++DceERzvMS6CUSNmJGrtJfwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DLLb6PDlLTpO7AXSyGKLP0LVzTqnGDIy8/1HkzHT9HwwZKbgdkfPrsd1VTaGtLuxY rkEl9gR1ws+aBP6etZ/gi80EdQJP1qwoIcGTuXl9vlRt3U+np5Z5T9soC1Bhw4Ln3w ysEsyp/xH9P/h3ou40eo1DcdA25Oh4PAWY7MspY4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, SeongJae Park , Andrew Morton Subject: [PATCH 6.18 027/377] mm/damon/sysfs-schemes: call missing mem_cgroup_iter_break() Date: Thu, 28 May 2026 21:44:25 +0200 Message-ID: <20260528194639.173506312@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194638.371537336@linuxfoundation.org> References: <20260528194638.371537336@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: SeongJae Park commit d4e7b5c4cc353f154d5ab8bb2e1ce7714d77a6e9 upstream. damon_sysfs_memcg_path_to_id() breaks mem_cgroup_iter() loop without calling mem_cgroup_iter_break(). This leaks the cgroup reference. Fix the issue by calling mem_cgroup_iter_break() before the break. The issue was discovered [1] by Sashiko. Link: https://lore.kernel.org/20260426173625.86521-1-sj@kernel.org Link: https://lore.kernel.org/20260423004148.74722-1-sj@kernel.org [1] Fixes: 29cbb9a13f05 ("mm/damon/sysfs-schemes: implement scheme filters") Signed-off-by: SeongJae Park Cc: # 6.3.x Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/damon/sysfs-schemes.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -2444,6 +2444,7 @@ static int damon_sysfs_memcg_path_to_id( if (damon_sysfs_memcg_path_eq(memcg, path, memcg_path)) { *id = mem_cgroup_id(memcg); found = true; + mem_cgroup_iter_break(NULL, memcg); break; } }