cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: JP Kobryn <inwardvessel@gmail.com>
Cc: shakeel.butt@linux.dev, mkoutny@suse.com, yosryahmed@google.com,
	hannes@cmpxchg.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH cgroup/for-6.16-fixes] cgroup: avoid null de-ref in css_rstat_exit()
Date: Sat, 9 Aug 2025 08:46:11 -1000	[thread overview]
Message-ID: <aJeXc2-GjqZI9I9F@slm.duckdns.org> (raw)
In-Reply-To: <20250807003350.178160-1-inwardvessel@gmail.com>

On Wed, Aug 06, 2025 at 05:33:50PM -0700, JP Kobryn wrote:
> css_rstat_exit() may be called asynchronously in scenarios where preceding
> calls to css_rstat_init() have not completed. One such example is this
> sequence below:
> 
> css_create(...)
> {
> 	...
> 	init_and_link_css(css, ...);
> 
> 	err = percpu_ref_init(...);
> 	if (err)
> 		goto err_free_css;
> 	err = cgroup_idr_alloc(...);
> 	if (err)
> 		goto err_free_css;
> 	err = css_rstat_init(css, ...);
> 	if (err)
> 		goto err_free_css;
> 	...
> err_free_css:
> 	INIT_RCU_WORK(&css->destroy_rwork, css_free_rwork_fn);
> 	queue_rcu_work(cgroup_destroy_wq, &css->destroy_rwork);
> 	return ERR_PTR(err);
> }
> 
> If any of the three goto jumps are taken, async cleanup will begin and
> css_rstat_exit() will be invoked on an uninitialized css->rstat_cpu.
> 
> Avoid accessing the unitialized field by returning early in
> css_rstat_exit() if this is the case.
> 
> Signed-off-by: JP Kobryn <inwardvessel@gmail.com>
> Suggested-by: Michal Koutný <mkoutny@suse.com>
> Fixes: 5da3bfa029d68 ("cgroup: use separate rstat trees for each subsystem")
> Reported-by: syzbot+8d052e8b99e40bc625ed@syzkaller.appspotmail.com
> Acked-by: Shakeel Butt <shakeel.butt@linux.dev>

Applied to cgroup/for-6.17-fixes.

Thanks.

-- 
tejun

  reply	other threads:[~2025-08-09 18:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07  0:33 [PATCH cgroup/for-6.16-fixes] cgroup: avoid null de-ref in css_rstat_exit() JP Kobryn
2025-08-09 18:46 ` Tejun Heo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-07-31 19:27 JP Kobryn
2025-08-01 17:38 ` Shakeel Butt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aJeXc2-GjqZI9I9F@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=inwardvessel@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=shakeel.butt@linux.dev \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).