mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
rtnetlink: release net refcnt on error in do_setlink()
[ Upstream commite0ebde0e13] rtnl_link_get_net() holds a reference on the 'struct net', we need to release it in case of error. CC: Eric W. Biederman <ebiederm@xmission.com> Fixes:b51642f6d7("net: Enable a userns root rtnl calls that are safe for unprivilged users") Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3e4410bb07
commit
5ee9f7cf65
@@ -1453,6 +1453,7 @@ static int do_setlink(const struct sk_buff *skb,
|
|||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) {
|
if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) {
|
||||||
|
put_net(net);
|
||||||
err = -EPERM;
|
err = -EPERM;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user