diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2014-11-27 10:16:15 +0100 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2015-01-06 13:59:52 +0100 |
commit | 6f6204584a51a9c36732d289cc037c256208b20e (patch) | |
tree | 267bb0fcdcc6396d1581f0f6b7337ddaacbbafb7 /net/core/rtnetlink.c | |
parent | 0b79861fc455782afb8f490d9e2e9102fa196bc2 (diff) | |
download | lwn-6f6204584a51a9c36732d289cc037c256208b20e.tar.gz lwn-6f6204584a51a9c36732d289cc037c256208b20e.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: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'net/core/rtnetlink.c')
-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 93ad6c5b2d77..f3224755b328 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1391,6 +1391,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; } |