diff mbox series

[v2,2/2] wifi: ath12k: fix undefined behavior with __fls in dp

Message ID 20230821130343.29495-3-quic_hprem@quicinc.com
State New
Headers show
Series wifi: ath12k: Ignore fragments from uninitialized peer | expand

Commit Message

Harshitha Prem Aug. 21, 2023, 1:03 p.m. UTC
When max virtual ap interfaces are configured in all the bands
with ACS and hostapd restart is done every 60s,
a crash is observed at random times because of handling the
uninitialized peer fragments with fragment id of packet as 0.

"__fls" would have an undefined behavior if the argument is passed
as "0". Hence, added changes to handle the same.

Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/dp_rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kalle Valo Aug. 22, 2023, 1:27 p.m. UTC | #1
Jeff Johnson <quic_jjohnson@quicinc.com> writes:

> On 8/21/2023 6:03 AM, Harshitha Prem wrote:
>> When max virtual ap interfaces are configured in all the bands
>> with ACS and hostapd restart is done every 60s,
>> a crash is observed at random times because of handling the
>> uninitialized peer fragments with fragment id of packet as 0.
>> "__fls" would have an undefined behavior if the argument is passed
>> as "0". Hence, added changes to handle the same.
>> Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7
>> devices")
>
> this should be in the last section with the Signed-off-by
>
> see
> <https://www.kernel.org/doc/html/latest/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes>

I can fix that in the pending branch, no need to resend because of this.
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c
index 5923c7c9eaff..ea8dfea22be6 100644
--- a/drivers/net/wireless/ath/ath12k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_rx.c
@@ -3238,7 +3238,7 @@  static int ath12k_dp_rx_frag_h_mpdu(struct ath12k *ar,
 		goto out_unlock;
 	}
 
-	if (frag_no > __fls(rx_tid->rx_frag_bitmap))
+	if ((!rx_tid->rx_frag_bitmap || frag_no > __fls(rx_tid->rx_frag_bitmap)))
 		__skb_queue_tail(&rx_tid->rx_frags, msdu);
 	else
 		ath12k_dp_rx_h_sort_frags(ab, &rx_tid->rx_frags, msdu);