Skip to contentSkip to conversation

cgroup: fix pointer check in css_rstat_init()

PATCH Applied JP Kobryn 2 participants 3 messages Apr 21, 2025

Subsystems (2)
lore
Share & tools
lore

JP Kobryn

author
#0 lore raw

PATCH 1/1 cgroup: fix pointer check in css_rstat_init()

In css_rstat_init() allocations are done for the cgroup's pointers rstat_cpu and rstat_base_cpu. Make sure the allocation checks are consistent with what they are allocating.

---
 kernel/cgroup/rstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/rstat.c +1 -1
index 4a8834a70ca6..4d5fd8d12bdd 100644
@@ -371,7 +371,7 @@ int css_rstat_init(struct cgroup_subsys_state *css)
 
 	if (!cgrp->rstat_base_cpu) {
 		cgrp->rstat_base_cpu = alloc_percpu(struct cgroup_rstat_base_cpu);
-		if (!cgrp->rstat_cpu) {
+		if (!cgrp->rstat_base_cpu) {
 			free_percpu(cgrp->rstat_cpu);
 			return -ENOMEM;
 		}
Signature · 1 line
2.47.1
maintainer Applied
#1 lore raw
Quoted 5 lines · JP Kobryn

In css_rstat_init() allocations are done for the cgroup's pointers rstat_cpu and rstat_base_cpu. Make sure the allocation checks are consistent with what they are allocating.

Applied to cgroup/for-6.16. BTW, it could be nicer if you note the commit that's being fixed or at least the target branch (here, cgroup/for-6.16).

Thanks.

Signature · 1 line
tejun
author
#2 lore raw
Quoted 5 lines · Tejun Heo
Quoted 4 lines · JP Kobryn

In css_rstat_init() allocations are done for the cgroup's pointers rstat_cpu and rstat_base_cpu. Make sure the allocation checks are consistent with what they are allocating.

Quoted 7 lines
Quoted 1 line

Applied to cgroup/for-6.16. BTW, it could be nicer if you note the commit that's being fixed or at least the target branch (here, cgroup/for-6.16).

Thanks.

Thanks, will keep in mind moving forward.