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,
Sven Eckelmann <sven@narfation.org>,
stable@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>,
Simon Wunderlich <sw@simonwunderlich.de>
Subject: [PATCH net 8/9] batman-adv: mcast: linearize skbuff for packet generation
Date: Fri, 21 Aug 2026 11:48:12 +0200 [thread overview]
Message-ID: <20260821094813.201800-9-sw@simonwunderlich.de> (raw)
In-Reply-To: <20260821094813.201800-1-sw@simonwunderlich.de>
From: Sven Eckelmann <sven@narfation.org>
batadv_mcast_forw_packet() and batadv_mcast_forw_scrape() is not only
called (indirectly) by the unsharing+linearizing batadv_recv_mcast_packet()
handler. When it is called (indirectly) by batadv_mcast_forw_mcsend() then
it will be unshared but not linearized. The SKB_LINEAR_ASSERT() can
therefore cause a fatal BUG().
The linearization should happen during the expansion of the head because
the scrape function can be hit already during the initial
batadv_mcast_forw_mode() selection code:
* batadv_interface_tx
* batadv_mcast_forw_mode
* batadv_mcast_forw_mode_by_count()
* batadv_mcast_forw_push()
-> calls batadv_mcast_forw_expand_head() before everything else
* batadv_mcast_forw_push_tvlvs()
* batadv_mcast_forw_push_dests()
* batadv_mcast_forw_push_adjust_padding()
* batadv_mcast_forw_scrape()
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Fixes: 90039133221e ("batman-adv: mcast: implement multicast packet generation")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/multicast_forw.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/batman-adv/multicast_forw.c b/net/batman-adv/multicast_forw.c
index 3927d28dcbb89..ac97cd8b81dc9 100644
--- a/net/batman-adv/multicast_forw.c
+++ b/net/batman-adv/multicast_forw.c
@@ -1108,6 +1108,10 @@ static int batadv_mcast_forw_expand_head(struct batadv_priv *bat_priv,
if (skb_cow(skb, hdr_size) < 0)
return -ENOMEM;
+ /* batadv_mcast_forw_scrape() + batadv_mcast_forw_packet() require linearized skb */
+ if (skb_linearize(skb) < 0)
+ return -ENOMEM;
+
return 0;
}
--
2.47.3
next prev parent reply other threads:[~2026-08-21 9:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 9:48 [PATCH net 0/9] pull request: batman-adv 2026-08-21 Simon Wunderlich
2026-08-21 9:48 ` [PATCH net 1/9] batman-adv: fix stale receive device on merged fragments Simon Wunderlich
2026-08-21 9:48 ` [PATCH net 2/9] batman-adv: bla: avoid CRC corruption due to parallel claim add Simon Wunderlich
2026-08-21 9:48 ` [PATCH net 3/9] batman-adv: bla: prevent CRC corruptions after claim flush Simon Wunderlich
2026-08-21 9:48 ` [PATCH net 4/9] batman-adv: dat: avoid unaligned fault in IP extraction Simon Wunderlich
2026-08-21 9:48 ` [PATCH net 5/9] batman-adv: dat: atomically update mac addresses Simon Wunderlich
2026-08-21 9:48 ` [PATCH net 6/9] batman-adv: fix TX priority extraction for BATADV_FORW_MCAST Simon Wunderlich
2026-08-21 9:48 ` [PATCH net 7/9] batman-adv: mcast: ensure unshared skb for multicast packets Simon Wunderlich
2026-08-21 9:48 ` Simon Wunderlich [this message]
2026-08-21 9:48 ` [PATCH net 9/9] batman-adv: bla: fix freeing of claims on meshif deletion 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=20260821094813.201800-9-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=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sashiko-bot@kernel.org \
--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