All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, kernel-team@fb.com,
	jiri@resnulli.us, andrew@lunn.ch, mkubecek@suse.cz
Subject: Re: [PATCH net-next 6/6] ethtool: specify which header flags are supported per command
Date: Mon, 05 Oct 2020 21:28:16 +0200	[thread overview]
Message-ID: <d5824faed8a748dc2f73dab16f914377cf972bc4.camel@sipsolutions.net> (raw)
In-Reply-To: <20201005122544.70aad7f5@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On Mon, 2020-10-05 at 12:25 -0700, Jakub Kicinski wrote:
> On Mon, 05 Oct 2020 20:58:57 +0200 Johannes Berg wrote:
> > On Mon, 2020-10-05 at 08:57 -0700, Jakub Kicinski wrote:
> > > @@ -47,19 +61,16 @@ int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info,
> > >  		NL_SET_ERR_MSG(extack, "request header missing");
> > >  		return -EINVAL;
> > >  	}
> > > +	/* Use most permissive header policy here, ops should specify their
> > > +	 * actual header policy via NLA_POLICY_NESTED(), and the real
> > > +	 * validation will happen in genetlink code.
> > > +	 */
> > >  	ret = nla_parse_nested(tb, ETHTOOL_A_HEADER_MAX, header,
> > > -			       ethnl_header_policy, extack);
> > > +			       ethnl_header_policy_stats, extack);  
> > 
> > Would it make sense to just remove the validation here? It's already
> > done, so it just costs extra cycles and can't really fail, and if there
> > are more diverse policies in the future this might also very quickly get
> > out of hand?
> 
> I was slightly worried I missed a command and need last line of defence,

Ah. I was just about to suggest to put it into the family policy/maxattr
but that won't work of course since this is nested.

But actually what you _could_ put there is a dummy policy (non-NULL
pointer) with a maxattr of 0, and then all attrs will be completely
rejected for a command where the policy was missed.

Not if you missed the NLA_POLICY_NESTED() link, though.

johannes


      reply	other threads:[~2020-10-05 19:28 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 15:57 [PATCH net-next 0/6] ethtool: allow dumping policies to user space Jakub Kicinski
2020-10-05 15:57 ` [PATCH net-next 1/6] ethtool: wire up get policies to ops Jakub Kicinski
2020-10-05 18:56   ` Johannes Berg
2020-10-05 19:16     ` Jakub Kicinski
2020-10-05 19:21       ` Johannes Berg
2020-10-05 19:31         ` Jakub Kicinski
2020-10-05 19:33           ` Johannes Berg
2020-10-05 19:41             ` Jakub Kicinski
2020-10-05 19:46               ` Johannes Berg
2020-10-05 19:51                 ` Jakub Kicinski
2020-10-05 21:52             ` Jacob Keller
2020-10-05 21:33           ` Jacob Keller
2020-10-05 15:57 ` [PATCH net-next 2/6] ethtool: use the attributes parsed by the core in get commands Jakub Kicinski
2020-10-05 15:57 ` [PATCH net-next 3/6] ethtool: wire up set policies to ops Jakub Kicinski
2020-10-05 15:57 ` [PATCH net-next 4/6] ethtool: link up ethnl_header_policy as a nested policy Jakub Kicinski
2020-10-05 15:57 ` [PATCH net-next 5/6] netlink: add mask validation Jakub Kicinski
2020-10-05 19:05   ` Johannes Berg
2020-10-05 19:22     ` Jakub Kicinski
2020-10-05 19:25       ` Johannes Berg
2020-10-05 19:34         ` Jakub Kicinski
2020-10-05 19:37           ` Johannes Berg
2020-10-05 19:47           ` Michal Kubecek
2020-10-05 19:28     ` Michal Kubecek
2020-10-05 19:31       ` Johannes Berg
2020-10-05 19:40         ` Jakub Kicinski
2020-10-05 19:53           ` Johannes Berg
2020-10-05 20:12             ` Johannes Berg
2020-10-05 22:21               ` Jakub Kicinski
2020-10-06  6:37                 ` Johannes Berg
2020-10-06 11:52                   ` Johannes Berg
2020-10-05 15:57 ` [PATCH net-next 6/6] ethtool: specify which header flags are supported per command Jakub Kicinski
2020-10-05 18:58   ` Johannes Berg
2020-10-05 19:25     ` Jakub Kicinski
2020-10-05 19:28       ` Johannes Berg [this message]

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=d5824faed8a748dc2f73dab16f914377cf972bc4.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=jiri@resnulli.us \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.