From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Kang Yang <kang.yang@oss.qualcomm.com>,
Vasanthakumar Thiagarajan
<vasanthakumar.thiagarajan@oss.qualcomm.com>,
Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
Sasha Levin <sashal@kernel.org>,
jjohnson@kernel.org, linux-wireless@vger.kernel.org,
ath12k@lists.infradead.org
Subject: [PATCH AUTOSEL 6.14 027/108] wifi: ath12k: fix macro definition HAL_RX_MSDU_PKT_LENGTH_GET
Date: Tue, 3 Jun 2025 20:54:10 -0400 [thread overview]
Message-ID: <20250604005531.4178547-27-sashal@kernel.org> (raw)
In-Reply-To: <20250604005531.4178547-1-sashal@kernel.org>
From: Kang Yang <kang.yang@oss.qualcomm.com>
[ Upstream commit a69bbf89d751ba2d6da21d773c4e29c91c5e53c4 ]
Currently, HAL_RX_MSDU_PKT_LENGTH_GET uses u32_get_bits to obtain the
MSDU length from the MSDU description.
This is not right. Because all halphy descriptions are little endian.
So use le32_get_bits for HAL_RX_MSDU_PKT_LENGTH_GET.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250421023444.1778-9-kang.yang@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
**YES** This commit should be backported to stable kernel trees as it
fixes a critical endianness bug that can cause data corruption and
system crashes. ## Analysis ### Nature of the Bug This is a **critical
endianness bug fix**, not a feature enhancement. The commit changes
`HAL_RX_MSDU_PKT_LENGTH_GET` from using `u32_get_bits` to
`le32_get_bits`. The issue is that the underlying data structure
`rx_msdu_desc` has `info0` declared as `__le32` (little-endian), but the
macro was treating it as native-endian. ### Critical Impact Areas **1.
Memory Safety & Data Corruption:** - The macro extracts MSDU (MAC
Service Data Unit) packet lengths from hardware descriptors - On big-
endian systems, `u32_get_bits` vs `le32_get_bits` would extract
completely wrong values - These incorrect lengths are used for buffer
bounds checking and memory allocation operations - This could lead to
buffer overflows, memory corruption, or kernel crashes **2. Cross-
Architecture Compatibility:** - This bug would manifest on big-endian
architectures (ARM BE, MIPS BE, PowerPC) - x86/x86_64 systems wouldn't
notice the bug due to little-endian architecture - The ath12k driver
supports multiple hardware variants that require correct endian handling
**3. Hardware Descriptor Consistency:** - Analysis shows the ath12k
driver predominantly uses `le32_get_bits` (287 instances vs 242
`u32_get_bits`) - All hardware-specific MSDU length extraction
consistently uses little-endian operations - The `struct rx_msdu_desc`
explicitly marks `info0` as `__le32`, confirming hardware uses little-
endian format ### Comparison with Similar Commits All the reference
commits marked "NO" were either: - Feature additions (A-MSDU indication
improvements) - Structural definition updates - Hardware descriptor
format corrections This commit differs fundamentally - it's fixing
actual data corruption that could cause crashes. ### Backporting
Justification - **Fixes user-affecting bug**: System crashes and data
corruption on big-endian systems - **Small and contained**: Single line
change with clear, targeted fix - **No architectural changes**: Only
corrects endianness handling - **Minimal regression risk**: Aligns code
with actual hardware behavior - **Critical subsystem**: Network packet
processing is core functionality This endianness bug represents exactly
the type of critical, low-risk fix that stable trees are designed to
address.
drivers/net/wireless/ath/ath12k/hal_desc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/hal_desc.h b/drivers/net/wireless/ath/ath12k/hal_desc.h
index a102d27e5785f..d155f95d21c39 100644
--- a/drivers/net/wireless/ath/ath12k/hal_desc.h
+++ b/drivers/net/wireless/ath/ath12k/hal_desc.h
@@ -707,7 +707,7 @@ enum hal_rx_msdu_desc_reo_dest_ind {
#define RX_MSDU_DESC_INFO0_DECAP_FORMAT GENMASK(30, 29)
#define HAL_RX_MSDU_PKT_LENGTH_GET(val) \
- (u32_get_bits((val), RX_MSDU_DESC_INFO0_MSDU_LENGTH))
+ (le32_get_bits((val), RX_MSDU_DESC_INFO0_MSDU_LENGTH))
struct rx_msdu_desc {
__le32 info0;
--
2.39.5
next prev parent reply other threads:[~2025-06-04 0:56 UTC|newest]
Thread overview: 108+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-04 0:53 [PATCH AUTOSEL 6.14 001/108] net: macb: Check return value of dma_set_mask_and_coherent() Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 002/108] net: lan743x: Modify the EEPROM and OTP size for PCI1xxxx devices Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 003/108] tipc: use kfree_sensitive() for aead cleanup Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 004/108] f2fs: use vmalloc instead of kvmalloc in .init_{,de}compress_ctx Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 005/108] bpf: Check rcu_read_lock_trace_held() in bpf_map_lookup_percpu_elem() Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 006/108] Bluetooth: btusb: Add new VID/PID 13d3/3584 for MT7922 Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 007/108] i2c: designware: Invoke runtime suspend on quick slave re-registration Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 008/108] wifi: mt76: mt7996: drop fragments with multicast or broadcast RA Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 009/108] emulex/benet: correct command version selection in be_cmd_get_stats() Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 010/108] Bluetooth: btusb: Add new VID/PID 13d3/3630 for MT7925 Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 011/108] Bluetooth: btusb: Add RTL8851BE device 0x0bda:0xb850 Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 012/108] Bluetooth: ISO: Fix not using SID from adv report Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 013/108] Bluetooth: btmrvl_sdio: Fix wakeup source leaks on device unbind Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 014/108] Bluetooth: btmtksdio: " Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 015/108] wifi: mt76: mt76x2: Add support for LiteOn WN4516R,WN4519R Sasha Levin
2025-06-04 0:53 ` [PATCH AUTOSEL 6.14 016/108] wifi: mt76: mt7921: add 160 MHz AP for mt7922 device Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 017/108] wifi: mt76: mt7925: introduce thermal protection Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 018/108] wifi: mac80211: validate SCAN_FLAG_AP in scan request during MLO Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 019/108] sctp: Do not wake readers in __sctp_write_space() Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 020/108] libbpf/btf: Fix string handling to support multi-split BTF Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 021/108] cpufreq: scmi: Skip SCMI devices that aren't used by the CPUs Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 022/108] i2c: tegra: check msg length in SMBUS block read Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 023/108] i2c: npcm: Add clock toggle recovery Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 024/108] clk: qcom: gcc-x1e80100: Set FORCE MEM CORE for UFS clocks Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 025/108] clk: qcom: gcc: Set FORCE_MEM_CORE_ON for gcc_ufs_axi_clk for 8650/8750 Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 026/108] net: dlink: add synchronization for stats update Sasha Levin
2025-06-04 0:54 ` Sasha Levin [this message]
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 028/108] wifi: ath12k: fix a possible dead lock caused by ab->base_lock Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 029/108] wifi: ath11k: Fix QMI memory reuse logic Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 030/108] iommu/amd: Allow matching ACPI HID devices without matching UIDs Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 031/108] wifi: rtw89: leave idle mode when setting WEP encryption for AP mode Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 032/108] tcp: always seek for minimal rtt in tcp_rcv_rtt_update() Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 033/108] tcp: remove zero TCP TS samples for autotuning Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 034/108] tcp: fix initial tp->rcvq_space.space value for passive TS enabled flows Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 035/108] tcp: add receive queue awareness in tcp_rcv_space_adjust() Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 036/108] x86/sgx: Prevent attempts to reclaim poisoned pages Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 037/108] ipv4/route: Use this_cpu_inc() for stats on PREEMPT_RT Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 038/108] net: page_pool: Don't recycle into cache " Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 039/108] xfrm: validate assignment of maximal possible SEQ number Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 040/108] openvswitch: Stricter validation for the userspace action Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 041/108] net: atlantic: generate software timestamp just before the doorbell Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 042/108] pinctrl: armada-37xx: propagate error from armada_37xx_pmx_set_by_name() Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 043/108] pinctrl: armada-37xx: propagate error from armada_37xx_gpio_get_direction() Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 044/108] bpf: Pass the same orig_call value to trampoline functions Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 045/108] net: stmmac: generate software timestamp just before the doorbell Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 046/108] pinctrl: armada-37xx: propagate error from armada_37xx_pmx_gpio_set_direction() Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 047/108] libbpf: Check bpf_map_skeleton link for NULL Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 048/108] pinctrl: armada-37xx: propagate error from armada_37xx_gpio_get() Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 049/108] net/mlx5: HWS, fix counting of rules in the matcher Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 050/108] net: mlx4: add SOF_TIMESTAMPING_TX_SOFTWARE flag when getting ts info Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 051/108] net: vertexcom: mse102x: Return code for mse102x_rx_pkt_spi Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 052/108] wifi: rtw88: rtw8822bu VID/PID for BUFFALO WI-U2-866DM Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 053/108] wireless: purelifi: plfxlc: fix memory leak in plfxlc_usb_wreq_asyn() Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 054/108] wifi: mac80211: do not offer a mesh path if forwarding is disabled Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 055/108] bpftool: Fix cgroup command to only show cgroup bpf programs Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 056/108] clk: rockchip: rk3036: mark ddrphy as critical Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 057/108] hid-asus: check ROG Ally MCU version and warn Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 058/108] rtla: Define __NR_sched_setattr for LoongArch Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 059/108] wifi: iwlwifi: mvm: fix beacon CCK flag Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 060/108] wifi: iwlwifi: dvm: pair transport op-mode enter/leave Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 061/108] bpf: Add bpf_rbtree_{root,left,right} kfunc Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 062/108] f2fs: fix to bail out in get_new_segment() Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 063/108] netfilter: nft_set_pipapo: clamp maximum map bucket size to INT_MAX Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 064/108] libbpf: Add identical pointer detection to btf_dedup_is_equiv() Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 065/108] scsi: lpfc: Fix lpfc_check_sli_ndlp() handling for GEN_REQUEST64 commands Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 066/108] scsi: smartpqi: Add new PCI IDs Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 067/108] iommu/amd: Ensure GA log notifier callbacks finish running before module unload Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 068/108] wifi: iwlwifi: pcie: make sure to lock rxq->read Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 069/108] wifi: rtw89: 8922a: fix TX fail with wrong VCO setting Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 070/108] wifi: mac80211_hwsim: Prevent tsf from setting if beacon is disabled Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 071/108] netdevsim: Mark NAPI ID on skb in nsim_rcv Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 072/108] net/mlx5: HWS, Fix IP version decision Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 073/108] bpf: Use proper type to calculate bpf_raw_tp_null_args.mask index Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 074/108] wifi: mac80211: VLAN traffic in multicast path Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 075/108] Revert "mac80211: Dynamically set CoDel parameters per station" Sasha Levin
2025-06-04 0:54 ` [PATCH AUTOSEL 6.14 076/108] wifi: iwlwifi: Add missing MODULE_FIRMWARE for Qu-c0-jf-b0 Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 077/108] net: bridge: mcast: update multicast contex when vlan state is changed Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 078/108] net: bridge: mcast: re-implement br_multicast_{enable, disable}_port functions Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 079/108] vxlan: Do not treat dst cache initialization errors as fatal Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 080/108] bnxt_en: Remove unused field "ref_count" in struct bnxt_ulp Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 081/108] vxlan: Add RCU read-side critical sections in the Tx path Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 082/108] wifi: ath12k: correctly handle mcast packets for clients Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 083/108] wifi: ath12k: using msdu end descriptor to check for rx multicast packets Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 084/108] net: ethernet: ti: am65-cpsw: handle -EPROBE_DEFER Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 085/108] software node: Correct a OOB check in software_node_get_reference_args() Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 086/108] wifi: ath12k: make assoc link associate first Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 087/108] isofs: fix Y2038 and Y2156 issues in Rock Ridge TF entry Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 088/108] pinctrl: mcp23s08: Reset all pins to input at probe Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 089/108] wifi: ath12k: fix failed to set mhi state error during reboot with hardware grouping Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 090/108] scsi: lpfc: Use memcpy() for BIOS version Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 091/108] sock: Correct error checking condition for (assign|release)_proto_idx() Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 092/108] i40e: fix MMIO write access to an invalid page in i40e_clear_hw Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 093/108] ixgbe: Fix unreachable retry logic in combined and byte I2C write functions Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 094/108] RDMA/hns: initialize db in update_srq_db() Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 095/108] ice: fix check for existing switch rule Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 096/108] usbnet: asix AX88772: leave the carrier control to phylink Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 097/108] f2fs: fix to set atomic write status more clear Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 098/108] bpf, sockmap: Fix data lost during EAGAIN retries Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 099/108] net: ethernet: cortina: Use TOE/TSO on all TCP Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 100/108] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer() Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 101/108] wifi: ath12k: Fix incorrect rates sent to firmware Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 102/108] wifi: ath12k: Fix the enabling of REO queue lookup table feature Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 103/108] wifi: ath12k: Fix memory leak due to multiple rx_stats allocation Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 104/108] wifi: ath11k: determine PM policy based on machine model Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 105/108] wifi: ath12k: fix link valid field initialization in the monitor Rx Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 106/108] wifi: ath12k: fix incorrect CE addresses Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 107/108] wifi: ath12k: Pass correct values of center freq1 and center freq2 for 160 MHz Sasha Levin
2025-06-04 0:55 ` [PATCH AUTOSEL 6.14 108/108] net/mlx5: HWS, Harden IP version definer checks Sasha Levin
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=20250604005531.4178547-27-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=ath12k@lists.infradead.org \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=jjohnson@kernel.org \
--cc=kang.yang@oss.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=vasanthakumar.thiagarajan@oss.qualcomm.com \
/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