rtnetlink: release net refcnt on error in do_setlink()
Subsystems (2)
PATCH 1/1 rtnetlink: release net refcnt on error in do_setlink()
rtnl_link_get_net() holds a reference on the 'struct net', we need to release it in case of error.
CC Eric W. Biederman <[email protected]>
Fixes b51642f6d77b ("net: Enable a userns root rtnl calls that are safe for unprivilged users")
Signed-off-by Nicolas Dichtel <[email protected]>
--- net/core/rtnetlink.c | 1 + 1 file changed, 1 insertion(+)
net/core/rtnetlink.c +1 -0
@@ -1498,6 +1498,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; }
Signature · 1 line
2.1.0
Quoted 6 lines · Nicolas Dichtel
rtnl_link_get_net()holds a reference on the 'struct net', we need to release it in case of error.CC Eric W. Biederman <[email protected]>Fixes b51642f6d77b ("net: Enable a userns root rtnl calls that are safe for unprivilged users")Signed-off-by Nicolas Dichtel <[email protected]>
Doh!
Reviewed-by "Eric W. Biederman" <[email protected]>
Quoted 16 lines
--- net/core/rtnetlink.c | 1 + 1 file changed, 1 insertion(+)net/core/rtnetlink.c +1
-0@@ -1498,6 +1498,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; }
David Miller
maintainerFrom: Nicolas Dichtel <[email protected]>
Date: Thu, 27 Nov 2014 10:16:15 +0100
Quoted 6 lines
rtnl_link_get_net()holds a reference on the 'struct net', we need to release it in case of error.CC Eric W. Biederman <[email protected]>Fixes b51642f6d77b ("net: Enable a userns root rtnl calls that are safe for unprivilged users")Signed-off-by Nicolas Dichtel <[email protected]>
Applied and queued up for -stable, thanks.