Re: [PATCH net] rtnetlink: fix netns leak with rtnl_setlink()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nicolas Dichtel <nicolas.dichtel@xxxxxxxxx>
Date: Wed,  5 Feb 2025 23:10:37 +0100
> A call to rtnl_nets_destroy() is needed to release references taken on
> netns put in rtnl_nets.
> 
> CC: stable@xxxxxxxxxxxxxxx
> Fixes: 636af13f213b ("rtnetlink: Register rtnl_dellink() and rtnl_setlink() with RTNL_FLAG_DOIT_PERNET_WIP.")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@xxxxxxxxx>

Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>

Thanks!


> ---
>  net/core/rtnetlink.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 1f4d4b5570ab..d1e559fce918 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -3432,6 +3432,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh,
>  		err = -ENODEV;
>  
>  	rtnl_nets_unlock(&rtnl_nets);
> +	rtnl_nets_destroy(&rtnl_nets);
>  errout:
>  	return err;
>  }
> -- 
> 2.47.1
> 




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux