ACK: [SRU Bionic] cgroup: add missing skcd->no_refcnt check in cgroup_sk_clone()

Stefan Bader stefan.bader at canonical.com
Thu Aug 27 07:01:46 UTC 2020


On 26.08.20 21:27, Thadeu Lima de Souza Cascardo wrote:
> From: Yang Yingliang <yangyingliang at 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 at huawei.com>
> Signed-off-by: Sasha Levin <sashal at kernel.org>
> (cherry picked from commit 1bfba2f4270c64c912756fc76621bbce959ddf2e linux-4.14.y)
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
Acked-by: Stefan Bader <stefan.bader at 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.
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20200827/639023ae/attachment.sig>


More information about the kernel-team mailing list