Commit 38de4308 authored by Yang Yingliang's avatar Yang Yingliang Committed by Greg Kroah-Hartman

cgroup: add missing skcd->no_refcnt check in cgroup_sk_clone()

Add skcd->no_refcnt check which is missed when backporting
ad0f75e5 ("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: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 37274b5c
......@@ -5957,6 +5957,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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment