Skip to contentSkip to conversation

cgroup: avoid null de-ref in css_rstat_exit()

PATCH In review JP Kobryn 2 participants 2 messages Jul 31, 2025 – Aug 1, 2025 cgroup

lore
Share & tools
lore

JP Kobryn

author
#0 lore raw

PATCH 1/1 cgroup: avoid null de-ref in css_rstat_exit()

This function may be called asynchronously in scenarios where preceding calls to css_rstat_init() have not completed. Return early in this case.

Fixes 5da3bfa029d68 ("cgroup: use separate rstat trees for each subsystem")
Reported-by [email protected]
---
 kernel/cgroup/rstat.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/cgroup/rstat.c +3 -0
index cbeaa499a96a..408e52d5f7a4 100644
@@ -488,6 +488,9 @@ void css_rstat_exit(struct cgroup_subsys_state *css)
 	if (!css_uses_rstat(css))
 		return;
 
+	if (!css->rstat_cpu)
+		return;
+
 	css_rstat_flush(css);
 
 	/* sanity check */
Signature · 1 line
2.47.3
Acked-by on v1 1/1
#1 lore raw
Quoted 1 line · JP Kobryn

This function

Name the function i.e. css_rstat_exit()

Quoted 2 lines

may be called asynchronously in scenarios where preceding calls to css_rstat_init() have not completed.

Explain some (or just one) of these scenarios in the commit.

Quoted 6 lines

Return early in this case.

Fixes 5da3bfa029d68 ("cgroup: use separate rstat trees for each subsystem")
Reported-by [email protected]

With the updated commit message, please include: