Re: [PATCH 0/5 cgroup/for-6.16-fixes] harden css_create() for safe placement of call to css_rstat_init()

From: JP Kobryn
Date: Mon Jul 28 2025 - 14:05:15 EST


Thanks for taking a look Michal.

On 7/25/25 10:23 AM, Michal Koutný wrote:
Hi.

On Mon, Jul 21, 2025 at 06:40:25PM -0700, JP Kobryn <inwardvessel@xxxxxxxxx> wrote:
...

Thanks for the instructive summary!

If any of the three goto jumps are taken, async cleanup will begin and
css_rstat_exit() will be invoked. But since css_rstat_init() would not have
succeeded, the warning will eventually be reached.
First thought is why not simply add a flag that'd guide whether
css_rstat_exit() has work to do.
I did consider adding an "initialized" flag to the css but since there can be multiple css's per
cgroup it felt like it would be adding overhead. So I went the path of getting the call
sequence right. I'm open to feedback on this, though.

This is meant as a fix, so it should have some metadata, I'd consider this one:
Fixes: 5da3bfa029d68 ("cgroup: use separate rstat trees for each subsystem")

(that's when css_rstat_init was moved to css_create)

and likely this
Reported-by: syzbot+8d052e8b99e40bc625ed@xxxxxxxxxxxxxxxxxxxxxxxxx

(Sorry for being such a bureaucrat.)
No problem, I overlooked that.
It's most appropriate in your 4/5 but do you think it'd be possible to
reshuffle the series to put the fix in front (to ease it for stable
kernels) and refactorings after?
Let me give that a try. As it is right now, patches 1-3 are pre-reqs for 4. I can try to get the
actual fix to the front and then add patches to additionally make nicer/refactor.