Message ID | 20250205221037.2474426-1-nicolas.dichtel@6wind.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 1438f5d07b9a7afb15e1d0e26df04a6fd4e56a3c |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] rtnetlink: fix netns leak with rtnl_setlink() | expand |
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 >
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!
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; }
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(+)