netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, kernel-team@fb.com,
	johannes@sipsolutions.net, jiri@resnulli.us, andrew@lunn.ch,
	mkubecek@suse.cz
Subject: Re: [PATCH net-next v2 3/7] ethtool: trim policy tables
Date: Thu, 8 Oct 2020 11:12:02 +0200	[thread overview]
Message-ID: <7d89d3a5-884c-5aba-1248-55f9cbecbd89@gmail.com> (raw)
In-Reply-To: <20201005220739.2581920-4-kuba@kernel.org>



On 10/6/20 12:07 AM, Jakub Kicinski wrote:
> Since ethtool uses strict attribute validation there's no need
> to initialize all attributes in policy tables. 0 is NLA_UNSPEC
> which is going to be rejected. Remove the NLA_REJECTs.
> 
> Similarly attributes above maxattrs are rejected, so there's
> no need to always size the policy tables to ETHTOOL_A_..._MAX.
> 

This implies that all policy tables must be 'complete'.

strset_stringsets_policy[] for example is :

static const struct nla_policy strset_stringsets_policy[] = {
    [ETHTOOL_A_STRINGSETS_STRINGSET]    = { .type = NLA_NESTED },
};

So when later strset_parse_request() does :

req_info->counts_only = tb[ETHTOOL_A_STRSET_COUNTS_ONLY];

We have an out-of-bound access since ETHTOOL_A_STRSET_COUNTS_ONLY > ETHTOOL_A_STRINGSETS_STRINGSET

Not sure what was the expected type for this attribute, the kernel
only looks at its presence, not its value.

  reply	other threads:[~2020-10-08  9:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 22:07 [PATCH net-next v2 0/7] ethtool: allow dumping policies to user space Jakub Kicinski
2020-10-05 22:07 ` [PATCH net-next v2 1/7] ethtool: wire up get policies to ops Jakub Kicinski
2020-10-05 22:07 ` [PATCH net-next v2 2/7] ethtool: wire up set " Jakub Kicinski
2020-10-05 22:07 ` [PATCH net-next v2 3/7] ethtool: trim policy tables Jakub Kicinski
2020-10-08  9:12   ` Eric Dumazet [this message]
2020-10-08  9:13     ` Johannes Berg
2020-10-08  9:15       ` Johannes Berg
2020-10-08 15:09         ` Eric Dumazet
2020-10-05 22:07 ` [PATCH net-next v2 4/7] ethtool: link up ethnl_header_policy as a nested policy Jakub Kicinski
2020-10-05 22:07 ` [PATCH net-next v2 5/7] netlink: create helpers for checking type is an int Jakub Kicinski
2020-10-05 22:07 ` [PATCH net-next v2 6/7] netlink: add mask validation Jakub Kicinski
2020-10-05 22:07 ` [PATCH net-next v2 7/7] ethtool: specify which header flags are supported per command Jakub Kicinski
2020-10-06  6:43 ` [PATCH net-next v2 0/7] ethtool: allow dumping policies to user space Johannes Berg
2020-10-06 13:26   ` David Miller
2020-10-07  6:27     ` Leon Romanovsky
2020-10-07  7:30       ` Johannes Berg
2020-10-07  8:24         ` Leon Romanovsky
2020-10-07  8:29           ` Johannes Berg
2020-10-07  8:33             ` Leon Romanovsky
2020-10-07 10:47             ` Leon Romanovsky
2020-10-07  8:52           ` Michal Kubecek
2020-10-07 10:48             ` Leon Romanovsky

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=7d89d3a5-884c-5aba-1248-55f9cbecbd89@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=jiri@resnulli.us \
    --cc=johannes@sipsolutions.net \
    --cc=kernel-team@fb.com \
    --cc=kuba@kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    /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).