* [PATCH] cgroup: fix potential null pointer risk
@ 2022-05-17 7:31 Shida Zhang
[not found] ` <20220517073106.1704628-1-zhangshida-UOlijcLmZ/InDS1+zs4M5A@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Shida Zhang @ 2022-05-17 7:31 UTC (permalink / raw)
To: tj, lizefan.x, hannes; +Cc: zhangshida, starzhangzsd, linux-kernel, cgroups
We previously assumed 'parent' could be null,
so null pointer judgment should be added.
Signed-off-by: Shida Zhang <zhangshida@kylinos.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
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <20220517073106.1704628-1-zhangshida-UOlijcLmZ/InDS1+zs4M5A@public.gmane.org>]
* Re: [PATCH] cgroup: fix potential null pointer risk [not found] ` <20220517073106.1704628-1-zhangshida-UOlijcLmZ/InDS1+zs4M5A@public.gmane.org> @ 2022-05-17 17:07 ` Tejun Heo [not found] ` <YoPWWfoZ+6PrHuJl-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Tejun Heo @ 2022-05-17 17:07 UTC (permalink / raw) To: Shida Zhang Cc: lizefan.x-EC8Uxl6Npydl57MIdRCFDg, hannes-druUgvl0LCNAfugRpC6u6w, zhangshida-UOlijcLmZ/InDS1+zs4M5A, linux-kernel-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA On Tue, May 17, 2022 at 03:31:06PM +0800, Shida Zhang wrote: > We previously assumed 'parent' could be null, > so null pointer judgment should be added. > > Signed-off-by: Shida Zhang <zhangshida-UOlijcLmZ/InDS1+zs4M5A@public.gmane.org> > --- > 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); The function is never called for a root cgroup. The parent check up above in the same function is superflous. So, maybe remove that? Thanks. -- tejun ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <YoPWWfoZ+6PrHuJl-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>]
* Re: [PATCH] cgroup: fix potential null pointer risk [not found] ` <YoPWWfoZ+6PrHuJl-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org> @ 2022-05-18 1:04 ` Stephen Zhang 0 siblings, 0 replies; 3+ messages in thread From: Stephen Zhang @ 2022-05-18 1:04 UTC (permalink / raw) To: Tejun Heo Cc: lizefan.x-EC8Uxl6Npydl57MIdRCFDg, hannes-druUgvl0LCNAfugRpC6u6w, zhangshida, linux-kernel-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 于2022年5月18日周三 01:07写道: > > The function is never called for a root cgroup. The parent check up above in > the same function is superflous. So, maybe remove that? > > Thanks. > > -- > tejun Thanks. I will remake a patch based on this. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-18 1:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-17 7:31 [PATCH] cgroup: fix potential null pointer risk Shida Zhang
[not found] ` <20220517073106.1704628-1-zhangshida-UOlijcLmZ/InDS1+zs4M5A@public.gmane.org>
2022-05-17 17:07 ` Tejun Heo
[not found] ` <YoPWWfoZ+6PrHuJl-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-05-18 1:04 ` Stephen Zhang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox