Re: [PATCH] cgroup: simplify cleanup in cgroup_css_set_fork()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Christian Brauner (Microsoft) <brauner@xxxxxxxxxx>
---
  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@xxxxxxxxxxx>

-Mukesh


base-commit: 1c23f9e627a7b412978b4e852793c5e3c3efc555



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux