Message ID | 20200826192722.52352-2-cascardo@canonical.com |
---|---|
State | New |
Headers | show |
Series | [SRU,Bionic] cgroup: add missing skcd->no_refcnt check in cgroup_sk_clone() | expand |
On 26.08.20 21:27, Thadeu Lima de Souza Cascardo wrote: > From: Yang Yingliang <yangyingliang@huawei.com> > > BugLink: https://bugs.launchpad.net/bugs/1886860 > > Add skcd->no_refcnt check which is missed when backporting > ad0f75e5f57c ("cgroup: fix cgroup_sk_alloc() for sk_clone_lock()"). > > This patch is needed in stable-4.9, stable-4.14 and stable-4.19. > > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> > Signed-off-by: Sasha Levin <sashal@kernel.org> > (cherry picked from commit 1bfba2f4270c64c912756fc76621bbce959ddf2e linux-4.14.y) > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> > --- > kernel/cgroup/cgroup.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c > index 963ec350d07e..37ca9b4b04b2 100644 > --- a/kernel/cgroup/cgroup.c > +++ b/kernel/cgroup/cgroup.c > @@ -5919,6 +5919,8 @@ void cgroup_sk_clone(struct sock_cgroup_data *skcd) > { > /* Socket clone path */ > if (skcd->val) { > + if (skcd->no_refcnt) > + return; > /* > * We might be cloning a socket which is left in an empty > * cgroup and the cgroup might have already been rmdir'd. >
On Wed, Aug 26, 2020 at 04:27:22PM -0300, Thadeu Lima de Souza Cascardo wrote: > From: Yang Yingliang <yangyingliang@huawei.com> > > BugLink: https://bugs.launchpad.net/bugs/1886860 > > Add skcd->no_refcnt check which is missed when backporting > ad0f75e5f57c ("cgroup: fix cgroup_sk_alloc() for sk_clone_lock()"). > > This patch is needed in stable-4.9, stable-4.14 and stable-4.19. > > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> > Signed-off-by: Sasha Levin <sashal@kernel.org> > (cherry picked from commit 1bfba2f4270c64c912756fc76621bbce959ddf2e linux-4.14.y) > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Makes sense to me. Acked-by: Andrea Righi <andrea.righi@canonical.com> > --- > kernel/cgroup/cgroup.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c > index 963ec350d07e..37ca9b4b04b2 100644 > --- a/kernel/cgroup/cgroup.c > +++ b/kernel/cgroup/cgroup.c > @@ -5919,6 +5919,8 @@ void cgroup_sk_clone(struct sock_cgroup_data *skcd) > { > /* Socket clone path */ > if (skcd->val) { > + if (skcd->no_refcnt) > + return; > /* > * We might be cloning a socket which is left in an empty > * cgroup and the cgroup might have already been rmdir'd. > -- > 2.25.1 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 963ec350d07e..37ca9b4b04b2 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -5919,6 +5919,8 @@ void cgroup_sk_clone(struct sock_cgroup_data *skcd) { /* Socket clone path */ if (skcd->val) { + if (skcd->no_refcnt) + return; /* * We might be cloning a socket which is left in an empty * cgroup and the cgroup might have already been rmdir'd.