From: Nikolay Aleksandrov <razor@blackwall.org>
To: Danielle Ratson <danieller@nvidia.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"dsahern@kernel.org" <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"horms@kernel.org" <horms@kernel.org>, "ja@ssi.bg" <ja@ssi.bg>,
Petr Machata <petrm@nvidia.com>, "fw@strlen.de" <fw@strlen.de>,
"kuniyu@google.com" <kuniyu@google.com>,
"bridge@lists.linux.dev" <bridge@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 4/5] bridge: Linearize skb once the ND message type is validated
Date: Mon, 27 Jul 2026 12:17:17 +0300 [thread overview]
Message-ID: <amciHRD1fvLO_ZWi@penguin> (raw)
In-Reply-To: <SJ2PR12MB9008AD38B9DA4AE6CF0A3998D8CD2@SJ2PR12MB9008.namprd12.prod.outlook.com>
On Sun, Jul 26, 2026 at 11:03:54AM +0000, Danielle Ratson wrote:
> > -----Original Message-----
> > From: Nikolay Aleksandrov <razor@blackwall.org>
> > Sent: Monday, 20 July 2026 12:26
> > To: Danielle Ratson <danieller@nvidia.com>; netdev@vger.kernel.org
> > Cc: dsahern@kernel.org; Ido Schimmel <idosch@nvidia.com>;
> > davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> > pabeni@redhat.com; horms@kernel.org; ja@ssi.bg; Petr Machata
> > <petrm@nvidia.com>; fw@strlen.de; kuniyu@google.com;
> > bridge@lists.linux.dev; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH net-next 4/5] bridge: Linearize skb once the ND message
> > type is validated
> >
> > On 19/07/2026 16:34, Danielle Ratson wrote:
> > > br_nd_send() parses ND options from ns->opt[] and therefore needs the
> > > skb to be linear. Commit a01aee7cafc5 ("bridge: br_nd_send: linearize
> > > skb before parsing ND options") ensured that by linearizing inside
> > > br_nd_send() itself.
> > >
> > > Move the linearization up into br_is_nd_neigh_msg(), right after
> > > ndisc_check_ns_na() has validated the message as an NS/NA. This makes
> > > a linear buffer a property of every recognized ND message, so that
> > > this and any future ND message handling operate on a linear skb and
> > > cannot reintroduce that class of bug by forgetting to linearize.
> > >
> > > Since the skb is now linear by the time br_nd_send() runs, drop the
> > > linearization there and derive ns from the transport header set by
> > > ndisc_check_ns_na(), instead of recomputing it from the network header.
> > >
> > > If linearization fails under memory pressure, br_is_nd_neigh_msg()
> > > returns NULL and the packet falls back to normal forwarding rather
> > > than being suppressed.
> > >
> > > Reviewed-by: Petr Machata <petrm@nvidia.com>
> > > Signed-off-by: Danielle Ratson <danieller@nvidia.com>
> > > ---
> > > net/bridge/br_arp_nd_proxy.c | 8 +++++---
> > > 1 file changed, 5 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/net/bridge/br_arp_nd_proxy.c
> > > b/net/bridge/br_arp_nd_proxy.c index 445c930ed59b..46779d9fad61
> > 100644
> > > --- a/net/bridge/br_arp_nd_proxy.c
> > > +++ b/net/bridge/br_arp_nd_proxy.c
> > > @@ -240,6 +240,9 @@ struct nd_msg *br_is_nd_neigh_msg(struct sk_buff
> > *skb)
> > > if (ndisc_check_ns_na(skb))
> > > return NULL;
> > >
> > > + if (skb_linearize(skb))
> > > + return NULL;
> > > +
> > > return (struct nd_msg *)skb_transport_header(skb);
> > > }
> >
> > This one is a bit weird - I wouldn't expect the check and validation to also
> > linearize the skb. I'd rename this helper to show that it also linearizes the skb.
> > Other than that the patch looks good.
>
> I agree it's not obvious from the name. But, I think it might be better to add a short comment than rename.
> The name captures the intent, while linearizing is just prep for the option parsing in br_nd_send().
> This also follows ipv6_mc_check_mld(), which is also a "check" that sets the transport header and documents its skb side effects in text rather than the name.
>
Yeah, I'm not a fan of check functions having side effects at all, but
it's not that big of a deal and more of a personal preference.
> No other function here has a kdoc, so I'd keep it a plain comment:
>
> /* Validate skb as an NS/NA and linearize it for br_nd_send()'s ND
> * option parsing; returns the nd_msg, or NULL on failure.
> */
>
> Would that work, or do you feel strongly about the rename?
>
That is ok.
Thanks,
Nik
> >
> > >
> > > @@ -259,7 +262,7 @@ static void br_nd_send(struct net_bridge *br, struct
> > net_bridge_port *p,
> > > bool dad;
> > > u16 pvid;
> > >
> > > - if (!dev || skb_linearize(request))
> > > + if (!dev)
> > > return;
> > >
> > > len = LL_RESERVED_SPACE(dev) + sizeof(struct ipv6hdr) + @@ -276,8
> > > +279,7 @@ static void br_nd_send(struct net_bridge *br, struct
> > net_bridge_port *p,
> > > skb_set_mac_header(reply, 0);
> > >
> > > daddr = eth_hdr(request)->h_source;
> > > - ns = (struct nd_msg *)(skb_network_header(request) +
> > > - sizeof(struct ipv6hdr));
> > > + ns = (struct nd_msg *)skb_transport_header(request);
> > >
> > > /* Do we need option processing ? */
> > > ns_olen = request->len - (skb_network_offset(request) +
>
next prev parent reply other threads:[~2026-07-27 9:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-19 13:34 [PATCH net-next 0/5] bridge: Validate and clean up IPv6 neighbour suppression Danielle Ratson
2026-07-19 13:34 ` [PATCH net-next 1/5] bridge: Use direct pointer in br_is_nd_neigh_msg() Danielle Ratson
2026-07-20 8:58 ` Nikolay Aleksandrov
2026-07-19 13:34 ` [PATCH net-next 2/5] ipv6: ndisc: Add ndisc_check_ns_na() validation helper Danielle Ratson
2026-07-20 9:13 ` Nikolay Aleksandrov
2026-07-19 13:34 ` [PATCH net-next 3/5] bridge: Validate NS/NA messages using ndisc_check_ns_na() Danielle Ratson
2026-07-20 9:14 ` Nikolay Aleksandrov
2026-07-19 13:34 ` [PATCH net-next 4/5] bridge: Linearize skb once the ND message type is validated Danielle Ratson
2026-07-20 9:26 ` Nikolay Aleksandrov
2026-07-26 11:03 ` Danielle Ratson
2026-07-27 9:17 ` Nikolay Aleksandrov [this message]
2026-07-19 13:34 ` [PATCH net-next 5/5] bridge: Use ndisc_parse_options() to parse ND options in br_nd_send() Danielle Ratson
2026-07-20 9:27 ` Nikolay Aleksandrov
2026-07-20 9:31 ` [PATCH net-next 0/5] bridge: Validate and clean up IPv6 neighbour suppression Nikolay Aleksandrov
2026-07-23 6:40 ` Danielle Ratson
2026-07-23 9:20 ` Nikolay Aleksandrov
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=amciHRD1fvLO_ZWi@penguin \
--to=razor@blackwall.org \
--cc=bridge@lists.linux.dev \
--cc=danieller@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=ja@ssi.bg \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox