Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7238191yba; Thu, 2 May 2019 06:41:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLh/61R1MZ3a6QLIYH4jUgP5anaqCeq7ZxDh7iRlnSC7VSTZcXod9kuVvrjwcA2AHQavvh X-Received: by 2002:a62:bd03:: with SMTP id a3mr4189825pff.81.1556804494059; Thu, 02 May 2019 06:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556804494; cv=none; d=google.com; s=arc-20160816; b=pwZALmTNEOTFtZ+l2t+hS50VuWfXGsAT8mYgi9JwFXnW2De60q5PrmqOoleXhhR0jM X0Hf3Pqef2l6bnZUoomT+9x6h0pICmdoWf70Ckl64+DlQKF4V9djhOoaVVscdxFkB/c4 xYa3nzLK5ZAL6V08uJ6u7Sb6lN6TFeuh3IttDnIdb4sy1qugJpbV4dxe279uWDl0Jb9+ UAuHvf1rrMmvEB7BG3mu8x1Rw0E9BFtFVp05HEJ53hPMAlZzbKblAbMWXakLM4Nz7RNw x/iJb3yyktGTca05Sx67Hh00Ke5b7W4zLb+JyD1H6Ipc7yWogjgBttT/iqjTXI9OLmVz 6cLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=7lTOIb797ZbgM37YhSzuOttlU06SmTOl4wegncATLZk=; b=MuF0LekIsfWKHFtx8343oMGhfxJ5ym9tOPP6Lmwn6YgF8RuqclVOHofNO4PzW5k1AJ rHXqOw0QJBpoeS1frmbwCaPGtie29oAp/YZ8H8ucTGQVWQNSJxxx/poKuL6wnYnROQka gI5Nx21zqO4IwiA2NSxLXtx+eWSW+WDXAKgCJGEjWhJ11MKbM+BMQkh81LTtGmL9ZUz7 zYnZBrd7HRF6LfWXsAswLPIx+ZYPGwE0KM5BPCKrFrHnd0xPZuZKcPvQjDI2+Aj6KXSR 0PvFFDmS8MyRFnLBF+mDsQ/qjlPxydnrY7Ose+Nu8mz5ZmxBkSNmt6HkIkgENgiZmjSF 73nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BHpTILKl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o32si48147364pld.190.2019.05.02.06.41.18; Thu, 02 May 2019 06:41:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BHpTILKl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726336AbfEBNk2 (ORCPT + 99 others); Thu, 2 May 2019 09:40:28 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:38792 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbfEBNk2 (ORCPT ); Thu, 2 May 2019 09:40:28 -0400 Received: by mail-it1-f194.google.com with SMTP id q19so3421786itk.3; Thu, 02 May 2019 06:40:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7lTOIb797ZbgM37YhSzuOttlU06SmTOl4wegncATLZk=; b=BHpTILKlTctQL2DRgAjqWw5ranFKQcCqUM2wzLyQt8LnOkc4ohbC0twXEKth2S2FBO cyBN3DJHClKL4DkM0iZrOkdMutYfyhsa5MP6NI/bkLMSw1bThxmrcTgAEQ5tTB/CDnY+ zrDNJyUdBosptp6bd6kv7b8dd8J9/jdMJS58JhcZAb7NPVwTnkvbvv/Myv2DhBIxGBMW XG0vF1IVU0SoG8cbkzV1xZLNPzKoElwJY8kSfPH7CbEexqV8vPGi/ZDnIE59U8poodYb NPkN6IBDD/C8RInHryahrCyH3S3Bbf+V3s69PwUTAo34E8nL67SuPAJmEE/1B3E4g6c0 5CDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7lTOIb797ZbgM37YhSzuOttlU06SmTOl4wegncATLZk=; b=OKrytRUbvl7H7Ch6oL+5H1XCarrdDUVA5q3rx/CX5o21gJ0k88ZcLU3rrWto+NGryN FsVF0+GminQ3S+zD71WOiKyp+qqDFqToRraLsCLTlkrF1zjsnYyG/Wy4rL701ovhlT/D GG7Hs5LAPah0BbkaQwDWEOv4yXPhKibREPFui4s8BJ7GTdCQx5d/MhZG2+ajnWLP/07e /prdG4kE+ToBf3aF1RzTW2f7LH7zOkLMyEGL7QzewvK7UElGORknubosZQIibJsFeahG 4z8JVHTi7yqrArrmC08+h/fS8J3EyrI1j9YYSxx6TbeWEyh5QXJKT5eN8iz82VGEeUT4 rFOw== X-Gm-Message-State: APjAAAXbb/uDIUqOj8R4eCT/HDmhCB8RYeV1CGxHyJOQHk8UjwvjjZ/z c6RWWtSk+3uaJ6vMiGSCqWkr98yZ X-Received: by 2002:a24:fa88:: with SMTP id v130mr2481013ith.122.1556804427420; Thu, 02 May 2019 06:40:27 -0700 (PDT) Received: from ?IPv6:2601:282:800:fd80:7d41:7f77:8419:85e7? ([2601:282:800:fd80:7d41:7f77:8419:85e7]) by smtp.googlemail.com with ESMTPSA id v64sm4655286ita.4.2019.05.02.06.40.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 May 2019 06:40:26 -0700 (PDT) Subject: Re: [PATCH net-next 3/3] netlink: add validation of NLA_F_NESTED flag To: Michal Kubecek , Johannes Berg Cc: "David S. Miller" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <75a0887b3eb70005c272685d8ef9a712f37d7a54.1556798793.git.mkubecek@suse.cz> <3e8291cb2491e9a1830afdb903ed2c52e9f7475c.camel@sipsolutions.net> <20190502131416.GE21672@unicorn.suse.cz> From: David Ahern Message-ID: Date: Thu, 2 May 2019 07:40:25 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190502131416.GE21672@unicorn.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/2/19 7:14 AM, Michal Kubecek wrote: >>> @@ -1132,6 +1136,10 @@ static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, >>> const struct nla_policy *policy, >>> struct netlink_ext_ack *extack) >>> { >>> + if (!(nla->nla_type & NLA_F_NESTED)) { >>> + NL_SET_ERR_MSG_ATTR(extack, nla, "nested attribute expected"); >> >> Maybe reword that to say "NLA_F_NESTED is missing" or so? The "nested >> attribute expected" could result in a lot of headscratching (without >> looking at the code) because it looks nested if you do nla_nest_start() >> etc. > > How about "NLA_F_NESTED is missing" and "NLA_F_NESTED not expected"? > That is much better to me.