* [PATCH] cgroup: simplify cleanup in cgroup_css_set_fork()
@ 2022-08-23 9:11 Christian Brauner
[not found] ` <20220823091147.846082-1-brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Christian Brauner @ 2022-08-23 9:11 UTC (permalink / raw)
To: Tejun Heo, cgroups-u79uwXL29TY76Z2rM5mHXA
Cc: Christian Brauner, Zefan Li, Johannes Weiner, Michal Koutný,
Al Viro
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.
Fixes: ef2c41cf38a7 ("clone3: allow spawning processes into cgroups")
Reported-by: Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
Signed-off-by: Christian Brauner (Microsoft) <brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
kernel/cgroup/cgroup.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index ffaccd6373f1..2ba516205057 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -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
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <20220823091147.846082-1-brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>]
* Re: [PATCH] cgroup: simplify cleanup in cgroup_css_set_fork() [not found] ` <20220823091147.846082-1-brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> @ 2022-08-23 11:09 ` Michal Koutný 2022-08-23 11:17 ` Mukesh Ojha 1 sibling, 0 replies; 3+ messages in thread From: Michal Koutný @ 2022-08-23 11:09 UTC (permalink / raw) To: Christian Brauner Cc: Tejun Heo, cgroups-u79uwXL29TY76Z2rM5mHXA, Zefan Li, Johannes Weiner, Al Viro Hello. On Tue, Aug 23, 2022 at 11:11:47AM +0200, Christian Brauner <brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote: > kernel/cgroup/cgroup.c | 2 -- > 1 file changed, 2 deletions(-) Sensible cleanup, Reviewed-by: Michal Koutný <mkoutny-IBi9RG/b67k@public.gmane.org> ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cgroup: simplify cleanup in cgroup_css_set_fork() [not found] ` <20220823091147.846082-1-brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 2022-08-23 11:09 ` Michal Koutný @ 2022-08-23 11:17 ` Mukesh Ojha 1 sibling, 0 replies; 3+ messages in thread From: Mukesh Ojha @ 2022-08-23 11:17 UTC (permalink / raw) To: Christian Brauner, Tejun Heo, cgroups-u79uwXL29TY76Z2rM5mHXA Cc: Zefan Li, Johannes Weiner, Michal Koutný, Al Viro Hi, On 8/23/2022 2:41 PM, Christian Brauner wrote: > 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. > > Fixes: ef2c41cf38a7 ("clone3: allow spawning processes into cgroups") > Reported-by: Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org> > Signed-off-by: Christian Brauner (Microsoft) <brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > --- > kernel/cgroup/cgroup.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c > index ffaccd6373f1..2ba516205057 100644 > --- a/kernel/cgroup/cgroup.c > +++ b/kernel/cgroup/cgroup.c > @@ -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. Reviewed-by: Mukesh Ojha <quic_mojha-jfJNa2p1gH1BDgjK7y7TUQ@public.gmane.org> -Mukesh > > base-commit: 1c23f9e627a7b412978b4e852793c5e3c3efc555 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-23 11:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-23 9:11 [PATCH] cgroup: simplify cleanup in cgroup_css_set_fork() Christian Brauner
[not found] ` <20220823091147.846082-1-brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2022-08-23 11:09 ` Michal Koutný
2022-08-23 11:17 ` Mukesh Ojha
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox