From: Leon Romanovsky <leon@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: ast@kernel.org, hawk@kernel.org, daniel@iogearbox.net,
netdev@vger.kernel.org, richardcochran@gmail.com,
john.fastabend@gmail.com, jesse.brandeburg@intel.com,
Lin Ma <linma@zju.edu.cn>,
edumazet@google.com, anthony.l.nguyen@intel.com,
intel-wired-lan@lists.osuosl.org, pabeni@redhat.com,
davem@davemloft.net, linux-kernel@vger.kernel.org
Subject: Re: [Intel-wired-lan] [PATCH v1] i40e: Add length check for IFLA_AF_SPEC parsing
Date: Tue, 25 Jul 2023 08:40:46 +0300 [thread overview]
Message-ID: <20230725054046.GK11388@unreal> (raw)
In-Reply-To: <20230724142155.13c83625@kernel.org>
On Mon, Jul 24, 2023 at 02:21:55PM -0700, Jakub Kicinski wrote:
> On Mon, 24 Jul 2023 20:44:35 +0300 Leon Romanovsky wrote:
> > > @@ -13186,6 +13186,9 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev,
> > > if (nla_type(attr) != IFLA_BRIDGE_MODE)
> > > continue;
> > >
> > > + if (nla_len(attr) < sizeof(mode))
> > > + return -EINVAL;
> > > +
> >
> > I see that you added this hunk to all users of nla_for_each_nested(), it
> > will be great to make that iterator to skip such empty attributes.
> >
> > However, i don't know nettlink good enough to say if your change is
> > valid in first place.
>
> Empty attributes are valid, we can't do that.
Maybe Lin can add special version of nla_for_each_nested() which will
skip these empty NLAs, for code which don't allow empty attributes.
>
> But there's a loop in rtnl_bridge_setlink() which checks the attributes.
> We can add the check there instead of all users, as Leon points out.
> (Please just double check that all ndo_bridge_setlink implementation
> expect this value to be a u16, they should/)
> --
> pw-bot: cr
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
WARNING: multiple messages have this Message-ID (diff)
From: Leon Romanovsky <leon@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Lin Ma <linma@zju.edu.cn>,
jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
richardcochran@gmail.com, ast@kernel.org, daniel@iogearbox.net,
hawk@kernel.org, john.fastabend@gmail.com,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] i40e: Add length check for IFLA_AF_SPEC parsing
Date: Tue, 25 Jul 2023 08:40:46 +0300 [thread overview]
Message-ID: <20230725054046.GK11388@unreal> (raw)
In-Reply-To: <20230724142155.13c83625@kernel.org>
On Mon, Jul 24, 2023 at 02:21:55PM -0700, Jakub Kicinski wrote:
> On Mon, 24 Jul 2023 20:44:35 +0300 Leon Romanovsky wrote:
> > > @@ -13186,6 +13186,9 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev,
> > > if (nla_type(attr) != IFLA_BRIDGE_MODE)
> > > continue;
> > >
> > > + if (nla_len(attr) < sizeof(mode))
> > > + return -EINVAL;
> > > +
> >
> > I see that you added this hunk to all users of nla_for_each_nested(), it
> > will be great to make that iterator to skip such empty attributes.
> >
> > However, i don't know nettlink good enough to say if your change is
> > valid in first place.
>
> Empty attributes are valid, we can't do that.
Maybe Lin can add special version of nla_for_each_nested() which will
skip these empty NLAs, for code which don't allow empty attributes.
>
> But there's a loop in rtnl_bridge_setlink() which checks the attributes.
> We can add the check there instead of all users, as Leon points out.
> (Please just double check that all ndo_bridge_setlink implementation
> expect this value to be a u16, they should/)
> --
> pw-bot: cr
next prev parent reply other threads:[~2023-07-25 5:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-23 7:50 [Intel-wired-lan] [PATCH v1] i40e: Add length check for IFLA_AF_SPEC parsing Lin Ma
2023-07-23 7:50 ` Lin Ma
2023-07-24 17:44 ` [Intel-wired-lan] " Leon Romanovsky
2023-07-24 17:44 ` Leon Romanovsky
2023-07-24 21:21 ` [Intel-wired-lan] " Jakub Kicinski
2023-07-24 21:21 ` Jakub Kicinski
2023-07-25 0:00 ` [Intel-wired-lan] " Lin Ma
2023-07-25 0:00 ` Lin Ma
2023-07-25 5:40 ` Leon Romanovsky [this message]
2023-07-25 5:40 ` Leon Romanovsky
2023-07-25 16:53 ` [Intel-wired-lan] " Jakub Kicinski
2023-07-25 16:53 ` Jakub Kicinski
2023-07-25 18:36 ` [Intel-wired-lan] " Leon Romanovsky
2023-07-25 18:36 ` 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=20230725054046.GK11388@unreal \
--to=leon@kernel.org \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linma@zju.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
/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.