* [PATCH] ath11k: fix potential wmi_mgmt_tx_queue race condition
@ 2021-02-18 6:45 Miaoqing Pan
2021-02-24 6:53 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Miaoqing Pan @ 2021-02-18 6:45 UTC (permalink / raw)
To: ath11k; +Cc: linux-wireless, Miaoqing Pan
There is a potential race condition between skb_queue_len()
and skb_queue_tail(), the former may get old value before
updated by the latter.
So use skb_queue_len_lockless() instead. And also use '>=',
in case we queue a few SKBs simultaneously.
Found while discussing a similar fix for ath10k:
https://patchwork.kernel.org/project/linux-wireless/patch/1608515579-1066-1-git-send-email-miaoqing@codeaurora.org/
No functional changes, compile tested only.
Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/mac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 335d49a..3c1f35a 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -4211,7 +4211,7 @@ static int ath11k_mac_mgmt_tx(struct ath11k *ar, struct sk_buff *skb,
return -ENOSPC;
}
- if (skb_queue_len(q) == ATH11K_TX_MGMT_NUM_PENDING_MAX) {
+ if (skb_queue_len_lockless(q) >= ATH11K_TX_MGMT_NUM_PENDING_MAX) {
ath11k_warn(ar->ab, "mgmt tx queue is full\n");
return -ENOSPC;
}
--
2.7.4
--
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ath11k: fix potential wmi_mgmt_tx_queue race condition
2021-02-18 6:45 [PATCH] ath11k: fix potential wmi_mgmt_tx_queue race condition Miaoqing Pan
@ 2021-02-24 6:53 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2021-02-24 6:53 UTC (permalink / raw)
To: Miaoqing Pan; +Cc: linux-wireless, ath11k, Miaoqing Pan
Miaoqing Pan <miaoqing@codeaurora.org> wrote:
> There is a potential race condition between skb_queue_len()
> and skb_queue_tail(), the former may get old value before
> updated by the latter.
>
> So use skb_queue_len_lockless() instead. And also use '>=',
> in case we queue a few SKBs simultaneously.
>
> Found while discussing a similar fix for ath10k:
> https://patchwork.kernel.org/project/linux-wireless/patch/1608515579-1066-1-git-send-email-miaoqing@codeaurora.org/
>
> No functional changes, compile tested only.
>
> Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Patch applied to ath-next branch of ath.git, thanks.
3808a18043a8 ath11k: fix potential wmi_mgmt_tx_queue race condition
--
https://patchwork.kernel.org/project/linux-wireless/patch/1613630709-704-1-git-send-email-miaoqing@codeaurora.org/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
--
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-24 6:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18 6:45 [PATCH] ath11k: fix potential wmi_mgmt_tx_queue race condition Miaoqing Pan
2021-02-24 6:53 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).