Skip to content

Commit

Permalink
cgroup: add missing skcd->no_refcnt check in cgroup_sk_clone()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Oktapra Amtono <oktapra.amtono@gmail.com>
  • Loading branch information
Yang Yingliang authored and okta-10 committed Mar 13, 2022
1 parent 5d0b0b2 commit e191539
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -6311,6 +6311,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.
Expand Down

0 comments on commit e191539

Please sign in to comment.