From: ebiederm@xmission.com (Eric W. Biederman)
To: David Miller <davem@davemloft.net>
Cc: Eugene Yakubovich <eugene.yakubovich@coreos.com>,
netdev@vger.kernel.org, nicolas.dichtel@6wind.com
Subject: [PATCH net 1/2] net: Verify permission to dest_net in newlink
Date: Thu, 26 Feb 2015 16:19:00 -0600 [thread overview]
Message-ID: <87egpcmi3v.fsf_-_@x220.int.ebiederm.org> (raw)
In-Reply-To: <54EF3338.8000409@6wind.com> (Nicolas Dichtel's message of "Thu, 26 Feb 2015 15:52:40 +0100")
When applicable verify that the caller has permision to create a
network device in another network namespace. This check is already
present when moving a network device between network namespaces in
setlink so all that is needed is to duplicate that check in newlink.
This change almost backports cleanly, but there are context conflicts
as the code that follows was added in v4.0-rc1
Fixes: b51642f6d77b131dc85d1d71029c3cbb5b07c262 net: Enable a userns root rtnl calls that are safe for unprivilged users
Cc: stable@vger.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
net/core/rtnetlink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ab293a3066b3..155e675f656c 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2122,6 +2122,10 @@ replay:
if (IS_ERR(dest_net))
return PTR_ERR(dest_net);
+ err = -EPERM;
+ if (!netlink_ns_capable(skb, dest_net->user_ns, CAP_NET_ADMIN))
+ goto out;
+
if (tb[IFLA_LINK_NETNSID]) {
int id = nla_get_s32(tb[IFLA_LINK_NETNSID]);
--
2.2.1
next prev parent reply other threads:[~2015-02-26 22:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 0:48 new link failing on duplicate names in different namespaces Eugene Yakubovich
2015-02-25 16:26 ` Nicolas Dichtel
2015-02-25 17:44 ` Eric W. Biederman
2015-02-26 5:29 ` Cong Wang
2015-02-26 5:56 ` Cong Wang
2015-02-26 9:14 ` Nicolas Dichtel
2015-02-26 13:55 ` Eric W. Biederman
2015-02-26 14:40 ` Nicolas Dichtel
2015-02-27 0:22 ` Cong Wang
2015-02-25 19:03 ` What are the intended semantics of IFLA_LINK_NETNSID? Eric W. Biederman
2015-02-26 5:07 ` Cong Wang
2015-02-26 8:55 ` Nicolas Dichtel
2015-02-26 13:48 ` Eric W. Biederman
2015-02-26 14:52 ` Nicolas Dichtel
2015-02-26 22:19 ` Eric W. Biederman [this message]
2015-02-26 22:20 ` [PATCH net 2/2] net: Verify permission to link_net in newlink Eric W. Biederman
2015-02-27 9:03 ` Nicolas Dichtel
2015-02-28 20:15 ` David Miller
2015-02-27 9:03 ` [PATCH net 1/2] net: Verify permission to dest_net " Nicolas Dichtel
2015-02-28 20:15 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87egpcmi3v.fsf_-_@x220.int.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=davem@davemloft.net \
--cc=eugene.yakubovich@coreos.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).