From f304da9134f8c245d198502ad681ffae63b5e29c Mon Sep 17 00:00:00 2001 From: JP Kobryn Date: Thu, 24 Apr 2025 10:53:58 -0700 Subject: [PATCH] cgroup: fix goto ordering in cgroup_init() Go to the appropriate section labels when css_rstat_init() or psi_cgroup_alloc() fails. Signed-off-by: JP Kobryn Fixes: a97915559f5c ("cgroup: change rstat function signatures from cgroup-based to css-based") Signed-off-by: Tejun Heo --- kernel/cgroup/cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index c284df1efc9fd..7471811a00de2 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -5708,11 +5708,11 @@ static struct cgroup *cgroup_create(struct cgroup *parent, const char *name, */ ret = css_rstat_init(&cgrp->self); if (ret) - goto out_stat_exit; + goto out_kernfs_remove; ret = psi_cgroup_alloc(cgrp); if (ret) - goto out_kernfs_remove; + goto out_stat_exit; if (cgrp->root == &cgrp_dfl_root) { ret = cgroup_bpf_inherit(cgrp); -- 2.50.1