Message ID | 20250212-rtnetlink_leak-v1-2-27bce9a3ac9a@bootlin.com (mailing list archive) |
---|---|
State | Rejected |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | rtnetlink: Fix small memory leaks | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net |
netdev/apply | fail | Patch does not apply to net-0 |
From: "Bastien Curutchet (eBPF Foundation)" <bastien.curutchet@bootlin.com> Date: Wed, 12 Feb 2025 09:23:48 +0100 > rtnl_setlink() uses the rtnl_nets_* helpers but never calls the > rtnl_nets_destroy(). It leads to small memory leaks. > > Call rtnl_nets_destroy() before exiting to properly decrement the nets' > reference counters. > > Fixes: 636af13f213b ("rtnetlink: Register rtnl_dellink() and rtnl_setlink() with RTNL_FLAG_DOIT_PERNET_WIP.") > Cc: stable@vger.kernel.org > Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com> It's fixed in 1438f5d07b9a ("rtnetlink: fix netns leak with rtnl_setlink()"). Thanks!
On 2/12/25 9:31 AM, Kuniyuki Iwashima wrote: > From: "Bastien Curutchet (eBPF Foundation)" <bastien.curutchet@bootlin.com> > Date: Wed, 12 Feb 2025 09:23:48 +0100 >> rtnl_setlink() uses the rtnl_nets_* helpers but never calls the >> rtnl_nets_destroy(). It leads to small memory leaks. >> >> Call rtnl_nets_destroy() before exiting to properly decrement the nets' >> reference counters. >> >> Fixes: 636af13f213b ("rtnetlink: Register rtnl_dellink() and rtnl_setlink() with RTNL_FLAG_DOIT_PERNET_WIP.") >> Cc: stable@vger.kernel.org >> Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com> > > It's fixed in 1438f5d07b9a ("rtnetlink: fix netns leak with > rtnl_setlink()"). > Oops, I missed it, sorry about that. Best regards, Bastien
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 94111d3383788566f2296039e68549e2b40d5a4a..e4ac14c081a48e36f5381e025a3991c90827c2bf 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -3441,6 +3441,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, rtnl_nets_unlock(&rtnl_nets); errout: + rtnl_nets_destroy(&rtnl_nets); return err; }
rtnl_setlink() uses the rtnl_nets_* helpers but never calls the rtnl_nets_destroy(). It leads to small memory leaks. Call rtnl_nets_destroy() before exiting to properly decrement the nets' reference counters. Fixes: 636af13f213b ("rtnetlink: Register rtnl_dellink() and rtnl_setlink() with RTNL_FLAG_DOIT_PERNET_WIP.") Cc: stable@vger.kernel.org Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com> --- net/core/rtnetlink.c | 1 + 1 file changed, 1 insertion(+)