* Re: [PATCH] cgroup: free cset links on find_css_set() failure [not found] <20260218120543.1113594-1-kaushlendra.kumar@intel.com> @ 2026-02-18 17:03 ` Tejun Heo 2026-02-21 3:35 ` Kumar, Kaushlendra 0 siblings, 1 reply; 2+ messages in thread From: Tejun Heo @ 2026-02-18 17:03 UTC (permalink / raw) To: Kaushlendra Kumar; +Cc: lizefan.x, hannes, cgroups, linux-kernel Hello, [This is an AI-assisted review.] On Wed, Feb 18, 2026 at 05:35:43PM +0530, Kaushlendra Kumar wrote: > When the recursive find_css_set() call for the domain > cset fails, tmp_links allocated earlier are not freed, > causing a memory leak. > > Free tmp_links before returning NULL to prevent the leak. tmp_links entries are consumed by link_css_set() which list_move_tail()'s each entry off tmp_links and into cgrp->cset_links and cset->cgrp_links. The BUG_ON(!list_empty(&tmp_links)) right after the linking loop (line 1281) confirms that tmp_links is empty by the time we reach the threaded cset handling code below. The links, now owned by cset->cgrp_links, are properly freed by put_css_set(cset) which is already called on this error path. So the added free_cgrp_cset_links() call would just iterate an empty list and is a no-op. There is no leak here. Thanks. -- tejun ^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] cgroup: free cset links on find_css_set() failure 2026-02-18 17:03 ` [PATCH] cgroup: free cset links on find_css_set() failure Tejun Heo @ 2026-02-21 3:35 ` Kumar, Kaushlendra 0 siblings, 0 replies; 2+ messages in thread From: Kumar, Kaushlendra @ 2026-02-21 3:35 UTC (permalink / raw) To: Tejun Heo Cc: lizefan.x@bytedance.com, hannes@cmpxchg.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org On <date>, Tejun Heo <tj@kernel.org> wrote: > tmp_links entries are consumed by link_css_set() which > list_move_tail()'s each entry off tmp_links and into > cgrp->cset_links and cset->cgrp_links. The BUG_ON > (!list_empty(&tmp_links)) right after the linking loop > (line 1281) confirms that tmp_links is empty by the > time we reach the threaded cset handling code below. > > The links, now owned by cset->cgrp_links, are properly > freed by put_css_set(cset) which is already called on > this error path. > > So the added free_cgrp_cset_links() call would just > iterate an empty list and is a no-op. There is no leak > here. You are right. put_css_set() already handles the cleanup. The added call is indeed a no-op. Dropping this patch. BR, Kaushlendra ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-21 3:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260218120543.1113594-1-kaushlendra.kumar@intel.com>
2026-02-18 17:03 ` [PATCH] cgroup: free cset links on find_css_set() failure Tejun Heo
2026-02-21 3:35 ` Kumar, Kaushlendra
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox