Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0ebde0

Browse files
NicolasDichteldavem330
authored andcommitted
rtnetlink: release net refcnt on error in do_setlink()
rtnl_link_get_net() holds a reference on the 'struct net', we need to release it in case of error. CC: Eric W. Biederman <[email protected]> Fixes: b51642f ("net: Enable a userns root rtnl calls that are safe for unprivilged users") Signed-off-by: Nicolas Dichtel <[email protected]> Reviewed-by: "Eric W. Biederman" <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f6c6fda commit e0ebde0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/core/rtnetlink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,7 @@ static int do_setlink(const struct sk_buff *skb,
14981498
goto errout;
14991499
}
15001500
if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) {
1501+
put_net(net);
15011502
err = -EPERM;
15021503
goto errout;
15031504
}

0 commit comments

Comments
 (0)