Skip to content

Commit 98d4f92

Browse files
miaoqing-quicjeff-t-johnson
authored andcommitted
wifi: ath12k: fix memory leak in ath12k_wifi7_dp_rx_h_verify_tkip_mic()
In ath12k_wifi7_dp_rx_h_verify_tkip_mic(), the call to ath12k_dp_rx_check_nwifi_hdr_len_valid() may return false when the NWIFI header length is invalid, causing the function to abort early with -EINVAL. When this happens, the error propagates to ath12k_wifi7_dp_rx_h_defrag(), which clears first_frag by setting it to NULL. As a result, the corresponding MSDU is no longer referenced by the defragmentation path and is never freed. This leads to a memory leak for the affected MSDU on this error path. Proper cleanup is required to ensure the MSDU is released when header validation fails during TKIP MIC verification. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3 Fixes: 9a0dddf ("wifi: ath12k: Fix invalid data access in ath12k_dp_rx_h_undecap_nwifi") Signed-off-by: Miaoqing Pan <miaoqing.pan@oss.qualcomm.com> Reviewed-by: Tamizh Chelvam Raja <tamizh.raja@oss.qualcomm.com> Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com> Link: https://patch.msgid.link/20260512021108.2031651-1-miaoqing.pan@oss.qualcomm.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
1 parent 10085a6 commit 98d4f92

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • drivers/net/wireless/ath/ath12k/wifi7

drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,10 @@ static int ath12k_wifi7_dp_rx_h_verify_tkip_mic(struct ath12k_pdev_dp *dp_pdev,
10281028
skb_pull(msdu, hal_rx_desc_sz);
10291029

10301030
if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(dp, msdu,
1031-
rx_info)))
1031+
rx_info))) {
1032+
dev_kfree_skb_any(msdu);
10321033
return -EINVAL;
1034+
}
10331035

10341036
ath12k_dp_rx_h_ppdu(dp_pdev, rx_info);
10351037
ath12k_dp_rx_h_undecap(dp_pdev, msdu, HAL_ENCRYPT_TYPE_TKIP_MIC, true,

0 commit comments

Comments
 (0)