From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.simonwunderlich.de (mail.simonwunderlich.de [23.88.38.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CD91313E36; Tue, 28 Jul 2026 13:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.88.38.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785245972; cv=none; b=Q9Ro17pwXtSPWXFO5ACghD3UsGsjOw0CWh9tj6xsvXNVUDypefUbW8GEuKwVSTAJ/UPwzESSIc/PNpTV94aFKXJWCl/12je1gfB2TW17ySSZCjw4OXTT83ybjg+ucCH9flilCS8ubDwxtfeVj6pFhcCxMMzMt6rcLMu6BjoDtvA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785245972; c=relaxed/simple; bh=Nw8OJylIrP4aOEXuoQob6nceh71QQGwEfnaVAB0zTaQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tCOml+tyhwrtpScbnCK6cgt4Vy+Y7JofR0qrF+3ifCbpnPkuvIrP8QL/bencQojJsmpqJziYZS38S5K4nm2qDt0sRNJFJdx0/l37rq8Z2Gx0dkb4FH/AesxXlGELkhoK2BgJS95VuIrivDBj0uI6zWpCNbTaFYug7ebQrOUFwRs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=simonwunderlich.de; spf=pass smtp.mailfrom=simonwunderlich.de; dkim=pass (2048-bit key) header.d=simonwunderlich.de header.i=@simonwunderlich.de header.b=mT/Pa/eu; arc=none smtp.client-ip=23.88.38.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=simonwunderlich.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=simonwunderlich.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=simonwunderlich.de header.i=@simonwunderlich.de header.b="mT/Pa/eu" Received: from kero.packetmixer.de (p200300c59717ead808f168c97e5563A8.dip0.t-ipconnect.de [IPv6:2003:c5:9717:ead8:8f1:68c9:7e55:63a8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.simonwunderlich.de (Postfix) with ESMTPSA id 105EAFA03F; Tue, 28 Jul 2026 15:39:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=simonwunderlich.de; s=09092022; t=1785245963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2vllbLYv6d8CwbU44HFIDs9FVXkprfgf+3gzh7Lhk1M=; b=mT/Pa/eu49EWPq83xTluHmLlHLS5qxM2SKjd47CFbiN13T+9j3HRc9dXhau54oVFO0h4nA kzUEX3F74wkeIiQhW0UTrIpNErK+aWvxyQ4/p6dVuB5NSgE/1nPUybV8H3JFoSWRozDW+r euUlzatxjw6qXxYbdxO5gK0htMM7cMC/kyh7Ox0wzcwNpo/ZIQHi7CkQQTSEJHAatbRpcN yvZRQaW3rYt7SrL7/dwbaqNsGO9Ic6ZISq9X8O+BvNchg8JcuTEHZk1Owo2C0yjVAcjPhH I8wC4VuroTt3MQzh98Dk9L/tLuJ2XBHoDoWrb050rI7n+4PaaX76rtmTuE7Iwg== From: Simon Wunderlich To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , b.a.t.m.a.n@lists.open-mesh.org, Sven Eckelmann , stable@vger.kernel.org, Simon Wunderlich Subject: [PATCH net-next 05/15] batman-adv: fix TX priority extraction for BATADV_FORW_MCAST Date: Tue, 28 Jul 2026 15:39:08 +0200 Message-ID: <20260728133918.643267-6-sw@simonwunderlich.de> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260728133918.643267-1-sw@simonwunderlich.de> References: <20260728133918.643267-1-sw@simonwunderlich.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Sven Eckelmann batadv_mcast_forw_mode_by_count() pushs the skb->data for BATADV_FORW_MCAST forwarding via batadv_mcast_forw_mcsend(). But the batadv_skb_set_priority() expects the ethernet header directly before (skb->data + offset). With the moved skb->data, just some random data would be accessed to get the priority data. Move the batadv_skb_set_priority() before the decision about the handling multicast packets and potential header modifications. Cc: stable@vger.kernel.org Fixes: 90039133221e ("batman-adv: mcast: implement multicast packet generation") Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich --- net/batman-adv/mesh-interface.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/batman-adv/mesh-interface.c b/net/batman-adv/mesh-interface.c index 1dc6cfae9e9ae..48bbb28d4576f 100644 --- a/net/batman-adv/mesh-interface.c +++ b/net/batman-adv/mesh-interface.c @@ -260,6 +260,8 @@ static netdev_tx_t batadv_interface_tx(struct sk_buff *skb, if (batadv_compare_eth(ethhdr->h_dest, ectp_addr)) goto dropped; + batadv_skb_set_priority(skb, 0); + gw_mode = READ_ONCE(bat_priv->gw.mode); if (is_multicast_ether_addr(ethhdr->h_dest)) { /* if gw mode is off, broadcast every packet */ @@ -293,6 +295,9 @@ static netdev_tx_t batadv_interface_tx(struct sk_buff *skb, send: if (do_bcast && !is_broadcast_ether_addr(ethhdr->h_dest)) { + /* WARNING batadv_mcast_forw_mode might add more headers + * in front of the skb. and might even reallocate the skb + */ forw_mode = batadv_mcast_forw_mode(bat_priv, skb, vid, &mcast_is_routable); switch (forw_mode) { @@ -310,8 +315,6 @@ static netdev_tx_t batadv_interface_tx(struct sk_buff *skb, } } - batadv_skb_set_priority(skb, 0); - /* ethernet packet should be broadcasted */ if (do_bcast) { primary_if = batadv_primary_if_get_selected(bat_priv); -- 2.47.3