diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2014-11-27 10:16:15 +0100 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2014-12-15 11:09:42 +0000 |
commit | e219e662fa54df4679d45840d2e7f87ea73bc010 (patch) | |
tree | 3cc7ac28bbfcf949938673cb78df6239afc25d63 /net | |
parent | d5197164692092d8199b5963204d825ffbdfccec (diff) | |
download | linux-stable-e219e662fa54df4679d45840d2e7f87ea73bc010.tar.gz linux-stable-e219e662fa54df4679d45840d2e7f87ea73bc010.tar.bz2 linux-stable-e219e662fa54df4679d45840d2e7f87ea73bc010.zip |
rtnetlink: release net refcnt on error in do_setlink()
commit e0ebde0e131b529fd721b24f62872def5ec3718c upstream.
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: Luis Henriques <luis.henriques@canonical.com>
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 e0b5ca349049..48c2be43f856 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1490,6 +1490,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; } |