netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] rtnetlink: fix netns leak with rtnl_setlink()
@ 2025-02-05 22:10 Nicolas Dichtel
  2025-02-05 23:45 ` Kuniyuki Iwashima
  2025-02-07  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Dichtel @ 2025-02-05 22:10 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	Kuniyuki Iwashima
  Cc: Simon Horman, Nikolay Aleksandrov, netdev, Nicolas Dichtel,
	stable

A call to rtnl_nets_destroy() is needed to release references taken on
netns put in rtnl_nets.

CC: stable@vger.kernel.org
Fixes: 636af13f213b ("rtnetlink: Register rtnl_dellink() and rtnl_setlink() with RTNL_FLAG_DOIT_PERNET_WIP.")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] rtnetlink: fix netns leak with rtnl_setlink()
  2025-02-05 22:10 [PATCH net] rtnetlink: fix netns leak with rtnl_setlink() Nicolas Dichtel
@ 2025-02-05 23:45 ` Kuniyuki Iwashima
  2025-02-07  1:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2025-02-05 23:45 UTC (permalink / raw)
  To: nicolas.dichtel
  Cc: davem, edumazet, horms, kuba, kuniyu, netdev, pabeni, razor,
	stable

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
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@vger.kernel.org
> Fixes: 636af13f213b ("rtnetlink: Register rtnl_dellink() and rtnl_setlink() with RTNL_FLAG_DOIT_PERNET_WIP.")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>

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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] rtnetlink: fix netns leak with rtnl_setlink()
  2025-02-05 22:10 [PATCH net] rtnetlink: fix netns leak with rtnl_setlink() Nicolas Dichtel
  2025-02-05 23:45 ` Kuniyuki Iwashima
@ 2025-02-07  1:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-07  1:30 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: davem, kuba, pabeni, edumazet, kuniyu, horms, razor, netdev,
	stable

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  5 Feb 2025 23:10:37 +0100 you wrote:
> A call to rtnl_nets_destroy() is needed to release references taken on
> netns put in rtnl_nets.
> 
> CC: stable@vger.kernel.org
> Fixes: 636af13f213b ("rtnetlink: Register rtnl_dellink() and rtnl_setlink() with RTNL_FLAG_DOIT_PERNET_WIP.")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> 
> [...]

Here is the summary with links:
  - [net] rtnetlink: fix netns leak with rtnl_setlink()
    https://git.kernel.org/netdev/net/c/1438f5d07b9a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-07  1:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-05 22:10 [PATCH net] rtnetlink: fix netns leak with rtnl_setlink() Nicolas Dichtel
2025-02-05 23:45 ` Kuniyuki Iwashima
2025-02-07  1:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).