diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2014-11-27 10:16:15 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-12-16 09:09:42 -0800 |
commit | 1973ac37c15ab85b170aa166b6192f45c03a3a5d (patch) | |
tree | 669b90807e7d20cd2963dfc3072b98cae64da486 /net | |
parent | cfcff6abc8bc6c4b9aa9e9cc93c2924a5c96b22d (diff) |
rtnetlink: release net refcnt on error in do_setlink()
[ Upstream commit e0ebde0e131b529fd721b24f62872def5ec3718c ]
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: b51642f6d77b ("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>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/rtnetlink.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index ae43dd807bb2..25c4dd563a79 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1318,6 +1318,7 @@ static int do_setlink(const struct sk_buff *skb, goto errout; } if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) { + put_net(net); err = -EPERM; goto errout; } |