Thread (7 messages) flat view 7 messages, 4 authors, 2018-02-04

Re: [PATCH net 1/1 v1] rtnetlink: require unique netns identifier

From: Christian Brauner <hidden>
Date: 2018-02-04 12:11:16
Also in: lkml

On Sat, Feb 03, 2018 at 11:17:01AM -0800, Stephen Hemminger wrote:
On Sat,  3 Feb 2018 14:29:04 +0100
Christian Brauner [off-list ref] wrote:
quoted
+static int rtnl_ensure_unique_netns_attr(const struct sock *sk,
+					 struct nlattr *tb[],
+					 struct netlink_ext_ack *extack)
+{
+	int ret = -EINVAL;
+	struct net *net = NULL, *unique_net = NULL;
+
+	/* Requests without network namespace ids have been able to specify
+	 * multiple properties referring to different network namespaces so
+	 * don't regress them.
+	 */
+	if (!tb[IFLA_IF_NETNSID])
+		return 0;
+
+	if (!tb[IFLA_NET_NS_PID] && !tb[IFLA_NET_NS_FD])
+		return 0;
Isn't this an error?
My reasoning was that having no explicit network namespace identifying
attributes the caller operates on the current network namespace which is
uniquely identified.
quoted
+
+	unique_net = get_net_ns_by_id(sock_net(sk), nla_get_s32(tb[IFLA_IF_NETNSID]));
+	if (!unique_net)
+		return -1;
Other paths are returning errno, so why -1 here?
Yes, this should be -EINVAL as well.

Thanks!
Christian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help