summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2014-11-27 10:16:15 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-12-16 09:34:27 -0800
commit5ee9f7cf65cd69d61b718eb40a53a9d2e3477827 (patch)
treef75a44a89562f8529a3467a0d0cbb276f5838775 /net
parent3e4410bb077de97319cb6d2e6a74e39f9d9a9503 (diff)
downloadlinux-stable-5ee9f7cf65cd69d61b718eb40a53a9d2e3477827.tar.gz
linux-stable-5ee9f7cf65cd69d61b718eb40a53a9d2e3477827.tar.bz2
linux-stable-5ee9f7cf65cd69d61b718eb40a53a9d2e3477827.zip
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.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index b0db904f083d..46175866851e 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1453,6 +1453,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;
}