From: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
To: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
coreteam@netfilter.org,
Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
Subject: [PATCH net v2 1/2] netfilter: nfnetlink_queue: only adjust bridged skbs that have a mac header
Date: Tue, 17 Nov 2026 20:58:34 +0300 [thread overview]
Message-ID: <20261117175835.745796-2-theodorlarionov@gmail.com> (raw)
In-Reply-To: <20261117175835.745796-1-theodorlarionov@gmail.com>
nf_bridge_adjust_skb_data() and nf_bridge_adjust_segmented_data() push
and pull skb_mac_header_len() bytes for any skb with bridge netfilter
info. A pskb copy of a bridged packet, such as one made by nft dup,
keeps that info, and the next patch unsets its mac header. With the mac
header unset, skb_mac_header_len() underflows and the push moves
skb->data out of the buffer before skb_gso_segment():
BUG: KASAN: slab-out-of-bounds in inet_gso_segment+0xd5f/0x1370
Only adjust skbs that have a mac header.
Fixes: a5fedd43d5f6 ("netfilter: move skb_gso_segment into nfnetlink_queue module")
Cc: stable@vger.kernel.org
Signed-off-by: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
---
net/netfilter/nfnetlink_queue.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index a8aa7ad832c3..fafadd9057cf 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -1084,13 +1084,13 @@ nf_queue_entry_dup(struct nf_queue_entry *e)
*/
static void nf_bridge_adjust_skb_data(struct sk_buff *skb)
{
- if (nf_bridge_info_get(skb))
+ if (nf_bridge_info_get(skb) && skb_mac_header_was_set(skb))
__skb_push(skb, skb_mac_header_len(skb));
}
static void nf_bridge_adjust_segmented_data(struct sk_buff *skb)
{
- if (nf_bridge_info_get(skb))
+ if (nf_bridge_info_get(skb) && skb_mac_header_was_set(skb))
__skb_pull(skb, skb_mac_header_len(skb));
}
#else
--
2.34.1
next prev parent reply other threads:[~2026-11-17 17:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 17:58 [PATCH net v2 0/2] net: do not point a pskb copy's mac header into uninitialised headroom Theodor Arsenij Larionov Trichkine
2026-11-17 17:58 ` Theodor Arsenij Larionov Trichkine [this message]
2026-11-17 17:58 ` [PATCH net v2 2/2] net: unset the mac header of a pskb copy that points into headroom Theodor Arsenij Larionov Trichkine
2026-11-17 18:03 ` [PATCH net v2 0/2] net: do not point a pskb copy's mac header into uninitialised headroom netdev-bot+sinfo
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=20261117175835.745796-2-theodorlarionov@gmail.com \
--to=theodorlarionov@gmail.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--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 \
/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