Skip to content

Commit

Permalink
rtnetlink: fix netns leak with rtnl_setlink()
Browse files Browse the repository at this point in the history
A call to rtnl_nets_destroy() is needed to release references taken on
netns put in rtnl_nets.

CC: stable@vger.kernel.org
Fixes: 636af13 ("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>
Link: https://patch.msgid.link/20250205221037.2474426-1-nicolas.dichtel@6wind.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Nicolas Dichtel authored and Jakub Kicinski committed Feb 7, 2025
1 parent bca0902 commit 1438f5d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1438f5d

Please sign in to comment.