From: Simon Wunderlich <sw@simonwunderlich.de>
To: netdev@vger.kernel.org
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>,
b.a.t.m.a.n@lists.open-mesh.org, Kyle Zeng <kylebot@openai.com>,
stable@vger.kernel.org, Sven Eckelmann <sven@narfation.org>,
Simon Wunderlich <sw@simonwunderlich.de>
Subject: [PATCH net 03/14] batman-adv: mcast: validate tracker padding before forwarding
Date: Fri, 30 Oct 2026 14:50:54 +0100 [thread overview]
Message-ID: <20261030135105.2555887-4-sw@simonwunderlich.de> (raw)
In-Reply-To: <20261030135105.2555887-1-sw@simonwunderlich.de>
From: Kyle Zeng <kylebot@openai.com>
A multicast tracker with an even number of destinations needs two
padding bytes after its destination list. batadv_mcast_forw_packet()
currently only checks that the count field and the addresses fit in
the tracker TVLV.
If an unpadded even tracker is compacted to an odd number of
destinations, batadv_mcast_forw_shrink_update_headers() includes those
missing padding bytes in the amount to remove. The subsequent memmove
can then write two bytes past the old packet tail. With no tailroom,
this corrupts skb_shared_info.
Include the required padding in the existing tracker length check.
This rejects the malformed tracker before either received or locally
generated packets can reach the compactor.
Fixes: 2dfe644a1ce0 ("batman-adv: mcast: shrink tracker packet after scrubbing")
Cc: stable@vger.kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/multicast_forw.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/multicast_forw.c b/net/batman-adv/multicast_forw.c
index ac97cd8b81dc9..9ffed1f237b6b 100644
--- a/net/batman-adv/multicast_forw.c
+++ b/net/batman-adv/multicast_forw.c
@@ -950,8 +950,11 @@ static int batadv_mcast_forw_packet(struct batadv_priv *bat_priv,
dest = (u8 *)mcast_tracker + sizeof(*mcast_tracker);
- /* check if full tracker tvlv is within skb length */
+ /* check if full tracker tvlv, including padding, is within skb length */
tvlv_len = sizeof(*mcast_tracker) + ETH_ALEN * num_dests;
+ if (!(num_dests % 2))
+ tvlv_len += 2;
+
if (tvlv_len > skb_network_header_len(skb))
return -EINVAL;
--
2.47.3
next prev parent reply other threads:[~2026-10-30 13:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 13:50 [PATCH net 00/14] pull request: batman-adv 2026-10-30 Simon Wunderlich
2026-10-30 13:50 ` [PATCH net 01/14] batman-adv: avoid WARN_ON for orig_ifinfo allocation failure Simon Wunderlich
2026-10-30 13:54 ` netdev-bot+sinfo
2026-10-30 13:50 ` [PATCH net v2 02/14] batman-adv: Close OGM aggregation before transmission Simon Wunderlich
2026-10-30 13:50 ` Simon Wunderlich [this message]
2026-10-30 13:50 ` [PATCH net 04/14] batman-adv: tpmeter: fix u32 truncation of reported bytes Simon Wunderlich
2026-10-30 13:50 ` [PATCH net 05/14] batman-adv: dat: initialize orig_node of unfilled candidate slots Simon Wunderlich
2026-10-30 13:50 ` [PATCH net 06/14] batman-adv: fix skb leak when hard_iface is being released Simon Wunderlich
2026-10-30 13:50 ` [PATCH net 07/14] batman-adv: stop originator purge worker before freeing TT Simon Wunderlich
2026-10-30 13:50 ` [PATCH net v2 08/14] batman-adv: tt: only transmit local ROAM flag together with DEL Simon Wunderlich
2026-10-30 13:51 ` [PATCH net 09/14] batman-adv: tt: clear ROAM flag when re-adding a pending local client Simon Wunderlich
2026-10-30 13:51 ` [PATCH net 10/14] batman-adv: tt: send ROAM_ADV on each roamed back client Simon Wunderlich
2026-10-30 13:51 ` [PATCH net 11/14] batman-adv: tt: ignore ROAM flag of received ADD changes Simon Wunderlich
2026-10-30 13:51 ` [PATCH net v2 12/14] batman-adv: tt: only update flags for TT events Simon Wunderlich
2026-10-30 13:51 ` [PATCH net v2 13/14] batman-adv: tt: don't drop local events queued during TVLV update Simon Wunderlich
2026-10-30 13:51 ` [PATCH net v2 14/14] batman-adv: tt: limit local table to single TVLV response size Simon Wunderlich
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=20261030135105.2555887-4-sw@simonwunderlich.de \
--to=sw@simonwunderlich.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kylebot@openai.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=sven@narfation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox