All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: "Christian Brauner"
	<brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"Zefan Li" <lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>,
	"Johannes Weiner"
	<hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	"Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org>,
	"Al Viro"
	<viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
Subject: [PATCH] cgroup: simplify cleanup in cgroup_css_set_fork()
Date: Tue, 23 Aug 2022 11:11:47 +0200	[thread overview]
Message-ID: <20220823091147.846082-1-brauner@kernel.org> (raw)

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


             reply	other threads:[~2022-08-23  9:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23  9:11 Christian Brauner [this message]
     [not found] ` <20220823091147.846082-1-brauner-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2022-08-23 11:09   ` [PATCH] cgroup: simplify cleanup in cgroup_css_set_fork() Michal Koutný
2022-08-23 11:17   ` Mukesh Ojha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220823091147.846082-1-brauner@kernel.org \
    --to=brauner-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
    --cc=mkoutny-IBi9RG/b67k@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.