* [PATCH net] rtnetlink: release net refcnt on error in do_setlink()
@ 2014-11-27 9:16 Nicolas Dichtel
2014-11-27 15:48 ` Eric W. Biederman
2014-11-30 5:07 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Dichtel @ 2014-11-27 9:16 UTC (permalink / raw)
To: davem; +Cc: netdev, Nicolas Dichtel, Eric W. Biederman
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>
---
net/core/rtnetlink.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index b9b7dfaf202b..76321ea442c3 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -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;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] rtnetlink: release net refcnt on error in do_setlink()
2014-11-27 9:16 [PATCH net] rtnetlink: release net refcnt on error in do_setlink() Nicolas Dichtel
@ 2014-11-27 15:48 ` Eric W. Biederman
2014-11-30 5:07 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Eric W. Biederman @ 2014-11-27 15:48 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: davem, netdev
Nicolas Dichtel <nicolas.dichtel@6wind.com> writes:
> 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>
Doh!
Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com>
> ---
> net/core/rtnetlink.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index b9b7dfaf202b..76321ea442c3 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -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;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] rtnetlink: release net refcnt on error in do_setlink()
2014-11-27 9:16 [PATCH net] rtnetlink: release net refcnt on error in do_setlink() Nicolas Dichtel
2014-11-27 15:48 ` Eric W. Biederman
@ 2014-11-30 5:07 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-11-30 5:07 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: netdev, ebiederm
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Thu, 27 Nov 2014 10:16:15 +0100
> 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>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-30 5:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-27 9:16 [PATCH net] rtnetlink: release net refcnt on error in do_setlink() Nicolas Dichtel
2014-11-27 15:48 ` Eric W. Biederman
2014-11-30 5:07 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox