Skip to contentSkip to conversation

ath11k: Avoid mgmt tx count underflow

PATCH In review Sriram R 2 participants 3 messages Mar 30, 2020 – Apr 6, 2020 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore

Sriram R

author
#0 lore raw

PATCH 1/1 ath11k: Avoid mgmt tx count underflow

The mgmt tx count reference is incremented/decremented on every mgmt tx and on tx completion event from firmware.
In case of an unexpected mgmt tx completion event from firmware, the counter would underflow. Avoid this by decrementing
only when the tx count is greater than 0.

---
 drivers/net/wireless/ath/ath11k/wmi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/wmi.c +3 -2
index e7ce369..d999c47 100644
@@ -3740,8 +3740,9 @@ static int wmi_process_mgmt_tx_comp(struct ath11k *ar, u32 desc_id,
 
 	ieee80211_tx_status_irqsafe(ar->hw, msdu);
 
-	WARN_ON_ONCE(atomic_read(&ar->num_pending_mgmt_tx) == 0);
-	atomic_dec(&ar->num_pending_mgmt_tx);
+	/* WARN when we received this event without doing any mgmt tx */
+	if (atomic_dec_if_positive(&ar->num_pending_mgmt_tx) < 0)
+		WARN_ON_ONCE(1);
 
 	return 0;
 }
Signature · 6 lines
2.7.4

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#1 lore raw
Quoted 8 lines · Sriram R

The mgmt tx count reference is incremented/decremented on every mgmt tx and on tx completion event from firmware.
In case of an unexpected mgmt tx completion event from firmware, the counter would underflow. Avoid this by decrementing
only when the tx count is greater than 0.

Patch applied to ath-next branch of ath.git, thanks.

800113ff4b1d ath11k: Avoid mgmt tx count underflow

Signature · 8 lines
https://patchwork.kernel.org/patch/11465279/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#2 lore raw
In reply to Sriram R
Quoted 8 lines · Sriram R

The mgmt tx count reference is incremented/decremented on every mgmt tx and on tx completion event from firmware.
In case of an unexpected mgmt tx completion event from firmware, the counter would underflow. Avoid this by decrementing
only when the tx count is greater than 0.

Patch applied to ath-next branch of ath.git, thanks.

800113ff4b1d ath11k: Avoid mgmt tx count underflow

Signature · 3 lines
https://patchwork.kernel.org/patch/11465279/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches