From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A54E2C5AD49 for ; Wed, 4 Jun 2025 01:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xrROX7ssdmHUvW468FQYk5iNoRNBEwKsTaIzPN2Ons4=; b=yjTNkshtRX4NUWLPgyF+L5bJKM E008MVP5i5RLFqEbfYJtc2A+Dl8aK2ZO1QHCgIwTchQTmvj/ALQFdK8sl34dRWL4yf9Rxhpc4vRFR 59aUi9HK+xge0kXVfT38qCnsqieCimpprURMCS8eQ5JQN/ZMDGQXxs3bEgRGKgA3mH5zM4G/mY2vy Tr9Svoob8EXIq218zUtXVHkpxelAl8QaX2JsZ0ReZqJQ9N4kbPfEYrUnDKge6t1c0/OJO3HVj+Wgb 65u2346Eb8gKnaZ52jGP7o1zJAa2hc46v1e4xK/OIoKU59x6MBut4voxkifKtyqlbgKKX39bm4kZR FPQoTgzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uMdPq-0000000CGHx-1euZ; Wed, 04 Jun 2025 01:59:42 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uMcSV-0000000C7dA-3sdr for ath12k@lists.infradead.org; Wed, 04 Jun 2025 00:58:24 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 57B7E60008; Wed, 4 Jun 2025 00:58:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04FE9C4CEF1; Wed, 4 Jun 2025 00:58:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748998703; bh=8VlDHP8blotr+uc9d03vKYUBplK//RGd9K4tZBW8ziQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KEgDwArtg9OdjiEl/6LXp5bgLQhZCcmojfZeuqwwFoYsVL1RO8ZsO2ucl0GpyzDx3 H9mL/J1CqUVNhiP8An5gvtnkv1F1mvODN5EbljbM6Lm+W3eF7G76b5r/zJk3tsK1sA c7FnUzDz4tGuJ0OUQLAi8gFtnl8s6CCkkbUSJkgwX0xDmS8qLJs8g+76PDTca/ltIM p1P5XfMQXs1i0b59IAKy6XtFkBd6AyI7QcokZ0CeOIZ0R4sVJdN3vY7K0TVRnCRyUK 8KjClVeC7gtJPRz2dlRwolbdjN4m2KM7Gnw9u/kRSMSI3xl7VkcF/wLMu4xXSE3LL8 dLcbNp6kzBkfQ== From: Sasha Levin To: patches@lists.linux.dev, stable@vger.kernel.org Cc: Sarika Sharma , Vasanthakumar Thiagarajan , Jeff Johnson , Sasha Levin , jjohnson@kernel.org, linux-wireless@vger.kernel.org, ath12k@lists.infradead.org Subject: [PATCH AUTOSEL 6.14 082/108] wifi: ath12k: correctly handle mcast packets for clients Date: Tue, 3 Jun 2025 20:55:05 -0400 Message-Id: <20250604005531.4178547-82-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250604005531.4178547-1-sashal@kernel.org> References: <20250604005531.4178547-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.14.9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: ath12k@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath12k" Errors-To: ath12k-bounces+ath12k=archiver.kernel.org@lists.infradead.org From: Sarika Sharma [ Upstream commit 4541b0c8c3c1b85564971d497224e57cf8076a02 ] Currently, RX is_mcbc bit is set for packets sent from client as destination address (DA) is multicast/broadcast address, but packets are actually unicast as receiver address (RA) is not multicast address. Hence, packets are not handled properly due to this is_mcbc bit. Therefore, reset the is_mcbc bit if interface type is AP. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Signed-off-by: Sarika Sharma Reviewed-by: Vasanthakumar Thiagarajan Link: https://patch.msgid.link/20250411061523.859387-3-quic_sarishar@quicinc.com Signed-off-by: Jeff Johnson Signed-off-by: Sasha Levin --- **YES** This commit should be backported to stable kernel trees. Here's my extensive analysis: ## Bug Analysis **Root Cause**: The commit fixes a critical packet handling issue where multicast/broadcast packets from clients to an AP are incorrectly marked as multicast (is_mcbc=true) based on the destination address (DA) being multicast, even though they are actually unicast packets since the receiver address (RA) is not multicast. **Impact**: This causes legitimate unicast packets to be mishandled, potentially leading to: - Incorrect encryption handling (using group keys instead of unicast keys) - Packet drops or processing errors - Connectivity issues for clients connected to AP ## Code Changes Analysis The fix involves three key changes: 1. **New peer field (`peer.h:65`)**: Adds `bool ucast_ra_only` field to track when a peer should only receive unicast packets 2. **Peer initialization (`peer.c:386-387`)**: Sets `peer->ucast_ra_only = true` for AP interface types, indicating that packets to/from AP clients should be treated as unicast 3. **Runtime correction (`dp_rx.c:2328-2331`)**: Adds logic to reset the is_mcbc bit when a peer has `ucast_ra_only=true`: ```c /bin /bin.usr-is-merged /boot /dev /etc /home /init /lib /lib.usr-is-merged /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /sbin.usr-is- merged /snap /srv /sys /tmp /usr /var resetting mcbc bit because mcbc packets are unicast capability_test capability_test.c f2fs_folio_analysis.md ipv4_multipath_analysis.md ipv6_route_allocation_rcu_analysis.md ixgbe_e610_set_phys_id_analysis.md linux lpfc_timeout_analysis.md mac80211_mlo_mbssid_analysis.md pfcp_driver_historical_analysis.md rtl_bb_delay_analysis.md rtw89_mlo_analysis.md tcp_multipath_load_balance_analysis.md test_unaligned_diff test_unaligned_diff.c type_size_check type_size_check.c veth_driver_analysis.md wifi_mlo_mbssid_tx_link_id_analysis.md packets only for AP as STA sends unicast packets. linux/ rxcb->is_mcbc = rxcb->is_mcbc && !peer->ucast_ra_only; ``` ## Backport Suitability Assessment **✅ Fixes Important Bug**: This addresses a real packet handling issue that affects AP functionality and client connectivity. **✅ Small and Contained**: The fix is minimal - adds one field and a simple boolean logic correction. Total change is ~10 lines. **✅ Low Regression Risk**: - Only affects AP mode (`NL80211_IFTYPE_AP`) - Uses conservative approach (resets mcbc bit only when appropriate) - No architectural changes **✅ Clear Side Effects**: The change is isolated to multicast/broadcast packet classification logic and doesn't touch other subsystems. **✅ Subsystem Confined**: Changes are entirely within the ath12k Wi-Fi driver's receive path. ## Comparison with Similar Commits This commit closely matches **Similar Commit #1** and **Similar Commit #3** (both marked YES for backporting): - Fixes multicast/broadcast packet handling issues in ath12k - Small, targeted fixes with clear bug descriptions - Hardware-specific corrections for packet classification - Similar code patterns and impact scope The commit follows the same pattern as other successful ath12k multicast fixes that were deemed suitable for stable backporting. ## Conclusion This is a classic stable tree candidate: it fixes a real user-impacting bug with a minimal, low- risk change that's confined to a single driver subsystem. The fix addresses incorrect packet classification that could cause connectivity issues in AP mode. drivers/net/wireless/ath/ath12k/dp_rx.c | 5 +++++ drivers/net/wireless/ath/ath12k/peer.c | 5 ++++- drivers/net/wireless/ath/ath12k/peer.h | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c index ff6a709b5042c..cfa96c6216177 100644 --- a/drivers/net/wireless/ath/ath12k/dp_rx.c +++ b/drivers/net/wireless/ath/ath12k/dp_rx.c @@ -2277,6 +2277,11 @@ static void ath12k_dp_rx_h_mpdu(struct ath12k *ar, spin_lock_bh(&ar->ab->base_lock); peer = ath12k_dp_rx_h_find_peer(ar->ab, msdu); if (peer) { + /* resetting mcbc bit because mcbc packets are unicast + * packets only for AP as STA sends unicast packets. + */ + rxcb->is_mcbc = rxcb->is_mcbc && !peer->ucast_ra_only; + if (rxcb->is_mcbc) enctype = peer->sec_type_grp; else diff --git a/drivers/net/wireless/ath/ath12k/peer.c b/drivers/net/wireless/ath/ath12k/peer.c index 792cca8a3fb1b..ec7236bbccc0f 100644 --- a/drivers/net/wireless/ath/ath12k/peer.c +++ b/drivers/net/wireless/ath/ath12k/peer.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022, 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "core.h" @@ -383,6 +383,9 @@ int ath12k_peer_create(struct ath12k *ar, struct ath12k_link_vif *arvif, arvif->ast_idx = peer->hw_peer_id; } + if (vif->type == NL80211_IFTYPE_AP) + peer->ucast_ra_only = true; + if (sta) { ahsta = ath12k_sta_to_ahsta(sta); arsta = wiphy_dereference(ath12k_ar_to_hw(ar)->wiphy, diff --git a/drivers/net/wireless/ath/ath12k/peer.h b/drivers/net/wireless/ath/ath12k/peer.h index 5870ee11a8c7e..f3a5e054d2b55 100644 --- a/drivers/net/wireless/ath/ath12k/peer.h +++ b/drivers/net/wireless/ath/ath12k/peer.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_PEER_H @@ -62,6 +62,7 @@ struct ath12k_peer { /* for reference to ath12k_link_sta */ u8 link_id; + bool ucast_ra_only; }; struct ath12k_ml_peer { -- 2.39.5