From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Ido Schimmel <idosch@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
Nikolay Aleksandrov <razor@blackwall.org>,
Bart De Schuymer <bdschuym@pandora.be>,
Patrick McHardy <kaber@trash.net>,
netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
coreteam@netfilter.org, bridge@lists.linux.dev
Subject: Re: [PATCH net v3] net: neigh: Reallocate headroom if necessary in neigh_hh_bridge()
Date: Thu, 14 May 2026 14:06:38 +0200 [thread overview]
Message-ID: <agW6zjwDHB3dTiZC@lore-desk> (raw)
In-Reply-To: <20260514081403.GA482081@shredder>
[-- Attachment #1: Type: text/plain, Size: 2158 bytes --]
> On Wed, May 13, 2026 at 06:40:28PM +0200, Lorenzo Bianconi wrote:
> > neigh_hh_bridge() assumes the skb always has sufficient headroom to copy
> > the aligned L2 header. This assumption can trigger the crash reported
> > below using the following netfilter setup:
> >
> > $modprobe br_netfilter
> > $sysctl -w net.bridge.bridge-nf-call-iptables=1
> >
> > $root@OpenWrt:~# nft list ruleset
> > table ip nat {
> > chain prerouting {
> > type nat hook prerouting priority dstnat; policy accept;
> > ip daddr 192.168.83.123 dnat to 192.168.83.120
> > }
> > }
> >
> > - iperf3 client (192.168.83.119) --> bridge (192.168.83.118) --> iperf3 server (192.168.83.120)
> >
> > the iperf3 client is sending packet for 192.168.83.123 to the bridge device.
>
> [...]
>
> >
> > Fix the issue reallocating the skb headroom if necessary in neigh_hh_bridge routine.
> >
> > Fixes: e179e6322ac33 ("netfilter: bridge-netfilter: Fix MAC header handling with IP DNAT")
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
>
> [...]
>
> > diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
> > index 0ab1c94db4b9..cea2352900e9 100644
> > --- a/net/bridge/br_netfilter_hooks.c
> > +++ b/net/bridge/br_netfilter_hooks.c
> > @@ -297,7 +297,13 @@ int br_nf_pre_routing_finish_bridge(struct net *net, struct sock *sk, struct sk_
> > goto free_skb;
> > }
> >
> > - neigh_hh_bridge(&neigh->hh, skb);
> > + ret = neigh_hh_bridge(&neigh->hh, skb);
> > + if (ret) {
> > + neigh_release(neigh);
> > + kfree_skb(skb);
> > + return ret;
>
> Personally I would use 'goto free_skb' after releasing the neighbour, to
> be consistent with the other paths that free the packet.
ack, I do not have a strong opinion about it, but in this case we would need to
even move "ret" since the current codebase always returns 0. What do you prefer?
Regards,
Lorenzo
>
> > + }
> > +
> > skb->dev = br_indev;
> >
> > ret = br_handle_frame_finish(net, sk, skb);
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-05-14 12:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 16:40 [PATCH net v3] net: neigh: Reallocate headroom if necessary in neigh_hh_bridge() Lorenzo Bianconi
2026-05-14 8:14 ` Ido Schimmel
2026-05-14 12:06 ` Lorenzo Bianconi [this message]
2026-05-14 13:42 ` Florian Westphal
2026-05-14 14:24 ` Lorenzo Bianconi
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=agW6zjwDHB3dTiZC@lore-desk \
--to=lorenzo@kernel.org \
--cc=bdschuym@pandora.be \
--cc=bridge@lists.linux.dev \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kaber@trash.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=razor@blackwall.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.