B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH batadv 3/3] batman-adv: mcast: linearize skbuff for packet generation
Date: Fri, 10 Jul 2026 05:22:37 +0200	[thread overview]
Message-ID: <13256198.O9o76ZdvQC@sven-desktop> (raw)
In-Reply-To: <20260709-mcast-header-generation-bugs-v1-3-c7c111fa45b6@narfation.org>

[-- Attachment #1: Type: text/plain, Size: 1857 bytes --]

On Thursday, 9 July 2026 21:45:57 CEST Sven Eckelmann wrote:
> batadv_mcast_forw_packet() is not only called by the unsharing+linearizing
> batadv_recv_mcast_packet() handler. When it is called by
> batadv_mcast_forw_mcsend() then it will be unshared but not linearized. The
> SKB_LINEAR_ASSERT() can therefore cause a fatal BUG().
> 
> The batadv_mcast_forw_packet() must handle the linearization itself.
> 
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Fixes: 8ed36122d709 ("batman-adv: mcast: implement multicast packet reception and forwarding")
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  net/batman-adv/multicast_forw.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/batman-adv/multicast_forw.c b/net/batman-adv/multicast_forw.c
> index c5b8e2e3..9fbd2876 100644
> --- a/net/batman-adv/multicast_forw.c
> +++ b/net/batman-adv/multicast_forw.c
> @@ -937,8 +937,10 @@ static int batadv_mcast_forw_packet(struct batadv_priv *bat_priv,
>  	u8 *dest;
>  	int ret;
>  
> -	/* (at least) TVLV part needs to be linearized */
> -	SKB_LINEAR_ASSERT(skb);
> +	/* packet needs to be linearized to access the tvlv content */
> +	ret = skb_linearize(skb);
> +	if (ret < 0)
> +		return -ENOMEM;
>  
>  	/* check if batadv_tvlv_mcast_tracker header is within skb length */
>  	if (sizeof(*mcast_tracker) > skb_network_header_len(skb))
> 
> 

We might move this to the same place as the skb_cow fix (see patch 2) because 
batadv_mcast_forw_scrape() has also this assert and following unlinearized-skb 
callchain exists:


batadv_interface_tx
batadv_mcast_forw_mode
batadv_mcast_forw_mode_by_count
batadv_mcast_forw_push
batadv_mcast_forw_push_tvlvs
batadv_mcast_forw_push_dests
batadv_mcast_forw_push_adjust_padding
batadv_mcast_forw_scrape


And this is called before batadv_mcast_forw_packet

Regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2026-07-10  3:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 19:45 [PATCH batadv 0/3] batman-adv: mcast header creation bugs Sven Eckelmann
2026-07-09 19:45 ` [PATCH batadv 1/3] batman-adv: fix TX priority extraction for BATADV_FORW_MCAST Sven Eckelmann
2026-07-09 19:45 ` [PATCH batadv 2/3] batman-adv: mcast: ensure unshared skb for multicast packets Sven Eckelmann
2026-07-09 19:45 ` [PATCH batadv 3/3] batman-adv: mcast: linearize skbuff for packet generation Sven Eckelmann
2026-07-10  3:22   ` Sven Eckelmann [this message]

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=13256198.O9o76ZdvQC@sven-desktop \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=sashiko-bot@kernel.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