lkml.org 
[lkml]   [2018]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net 1/1 v1] rtnetlink: require unique netns identifier
On Sat, Feb 03, 2018 at 07:09:55PM -0700, David Ahern wrote:
> On 2/3/18 12:17 PM, Stephen Hemminger wrote:
> > On Sat, 3 Feb 2018 14:29:04 +0100
> > Christian Brauner <christian.brauner@ubuntu.com> wrote:
> >
> >> +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?
> >
> >> +
> >> + 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?
> >
>
> extack needs to be filled in too.

Yeah, it should report that an invalid network namespace identifier has
been specified.

Thanks!
Christian

\
 
 \ /
  Last update: 2018-02-04 13:12    [W:0.063 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site