cgroup: simplify cleanup in cgroup_css_set_fork()
PATCH 1/1 cgroup: simplify cleanup in cgroup_css_set_fork()
The call that initializes kargs->cset is find_css_set() and it is the last call in cgroup_css_set_fork(). If find_css_set() fails kargs->cset is NULL and we go to the cleanup path where we check that kargs->cset is non-NULL and if it is we call put_css_set(kargs->cset). But it'll always be NULL so put_css_set(kargs->cset) is never hit. Remove it.
--- kernel/cgroup/cgroup.c | 2 -- 1 file changed, 2 deletions(-)
kernel/cgroup/cgroup.c +0 -2
@@ -6247,8 +6247,6 @@ static int cgroup_css_set_fork(struct kernel_clone_args *kargs)if (dst_cgrp)cgroup_put (dst_cgrp);put_css_set (cset); -if (kargs->cset) -put_css_set (kargs->cset);return ret; }
base-commit: 1c23f9e627a7b412978b4e852793c5e3c3efc555
Signature · 1 line
2.34.1
A message that is not in the archive (sent off-list or not yet received): 20220823091147.846082-1-brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Michal Koutný
Reviewed-byHello.
Quoted 2 lines · Christian Brauner
kernel/cgroup/cgroup.c | 2 -- 1 file changed, 2 deletions(-)
Sensible cleanup,
Mukesh Ojha
Reviewed-byHi,
Quoted 18 lines · Christian Brauner
The call that initializes
kargs->csetisfind_css_set()and it is the last call incgroup_css_set_fork(). Iffind_css_set()failskargs->csetis NULL and we go to the cleanup path where we check thatkargs->csetis non-NULL and if it is we callput_css_set(kargs->cset). But it'll always be NULL soput_css_set(kargs->cset)is never hit. Remove it.Fixes ef2c41cf38a7 ("clone3: allow spawning processes into cgroups")Reported-by Al Viro <viro-RmSDqhL/[email protected]>Signed-off-by Christian Brauner (Microsoft) <[email protected]>--- kernel/cgroup/cgroup.c | 2 -- 1 file changed, 2 deletions(-)kernel/cgroup/cgroup.c +0
-0
kernel/cgroup/cgroup.c static int cgroup_css_set_fork(struct kernel_clone_args *kargs) · line 6252
Quoted 8 lines
kernel/cgroup/cgroup.c +0
-2@@ -6247,8 +6247,6 @@ static int cgroup_css_set_fork(struct kernel_clone_args *kargs)if (dst_cgrp)cgroup_put (dst_cgrp);put_css_set (cset); -if (kargs->cset) -put_css_set (kargs->cset);return ret; }
LGTM.
-Mukesh
Quoted 2 lines
base-commit:
1c23f9e627a7b412978b4e852793c5e3c3efc555