[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220517073106.1704628-1-zhangshida@kylinos.cn>
Date: Tue, 17 May 2022 15:31:06 +0800
From: Shida Zhang <starzhangzsd@...il.com>
To: tj@...nel.org, lizefan.x@...edance.com, hannes@...xchg.org
Cc: zhangshida@...inos.cn, starzhangzsd@...il.com,
linux-kernel@...r.kernel.org, cgroups@...r.kernel.org
Subject: [PATCH] cgroup: fix potential null pointer risk
We previously assumed 'parent' could be null,
so null pointer judgment should be added.
Signed-off-by: Shida Zhang <zhangshida@...inos.cn>
---
kernel/cgroup/cgroup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index adb820e98f24..7f230b0ab644 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5701,7 +5701,8 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
}
spin_unlock_irq(&css_set_lock);
- cgroup1_check_for_release(parent);
+ if (parent)
+ cgroup1_check_for_release(parent);
cgroup_bpf_offline(cgrp);
--
2.25.1
Powered by blists - more mailing lists