From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH net-next 06/20] net/ipv4: Update inet_dump_ifaddr for strict data checking Date: Fri, 5 Oct 2018 12:48:54 -0600 Message-ID: <4e181661-1231-1512-068d-d1bdb5e62bb3@gmail.com> References: <20181004213355.14899-1-dsahern@kernel.org> <20181004213355.14899-7-dsahern@kernel.org> <20181005180232.5v5as3yhx4gio6oy@brauner.io> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, davem@davemloft.net, jbenc@redhat.com, stephen@networkplumber.org To: Christian Brauner , David Ahern Return-path: Received: from mail-pl1-f196.google.com ([209.85.214.196]:40728 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728759AbeJFBs4 (ORCPT ); Fri, 5 Oct 2018 21:48:56 -0400 Received: by mail-pl1-f196.google.com with SMTP id 1-v6so7234644plv.7 for ; Fri, 05 Oct 2018 11:48:57 -0700 (PDT) In-Reply-To: <20181005180232.5v5as3yhx4gio6oy@brauner.io> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 10/5/18 12:02 PM, Christian Brauner wrote: >> + >> + err = nlmsg_parse(nlh, sizeof(struct ifaddrmsg), tb, IFA_MAX, >> + ifa_ipv4_policy, extack); >> + if (err < 0) >> + return err; >> >> - tgt_net = rtnl_get_net_ns_capable(skb->sk, >> - fillargs.netnsid); >> - if (IS_ERR(tgt_net)) >> - return PTR_ERR(tgt_net); >> + for (i = 0; i <= IFA_MAX; ++i) { >> + if (!tb[i]) >> + continue; >> + if (i == IFA_TARGET_NETNSID) { > > Nit: For the sake of readability there could be an additional newline between the > "continue" and the next if () condition. > >> + fillargs.netnsid = nla_get_s32(tb[i]); >> + >> + tgt_net = rtnl_get_net_ns_capable(skb->sk, >> + fillargs.netnsid); >> + if (IS_ERR(tgt_net)) { >> + NL_SET_ERR_MSG(extack, "Invalid target namespace id"); > > Nit: Hm, maybe "Invalid target network namespace id" would be better. > You never know what namespace comes along some time later. :) > done.