OSDN Git Service

staging: wfx: fix atomic accesses in wfx_tx_queue_empty()
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Mon, 13 Sep 2021 13:01:38 +0000 (15:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Sep 2021 07:16:32 +0000 (09:16 +0200)
Checking if a skb_queue is empty is not an atomic operation. We should
take some precautions to do it.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20210913130203.1903622-8-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/queue.c

index 31c37f6..fa272c1 100644 (file)
@@ -86,7 +86,8 @@ void wfx_tx_queues_check_empty(struct wfx_vif *wvif)
 
 bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue)
 {
-       return skb_queue_empty(&queue->normal) && skb_queue_empty(&queue->cab);
+       return skb_queue_empty_lockless(&queue->normal) &&
+              skb_queue_empty_lockless(&queue->cab);
 }
 
 static void __wfx_tx_queue_drop(struct wfx_vif *wvif,