Re: [PATCH net 2/2] rtnetlink: Release nets when leaving rtnl_setlink()

From: Kuniyuki Iwashima
Date: Wed Feb 12 2025 - 03:31:53 EST


From: "Bastien Curutchet (eBPF Foundation)" <bastien.curutchet@xxxxxxxxxxx>
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@xxxxxxxxxxxxxxx
> Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@xxxxxxxxxxx>

It's fixed in 1438f5d07b9a ("rtnetlink: fix netns leak with
rtnl_setlink()").

Thanks!