public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath11k: acquire ab->base_lock in unassign when finding the peer by addr
@ 2022-03-14 21:52 Niels Dossche
  2022-03-16  6:13 ` Kalle Valo
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Niels Dossche @ 2022-03-14 21:52 UTC (permalink / raw)
  To: ath11k
  Cc: linux-wireless, Kalle Valo, David S. Miller, Jakub Kicinski,
	Carl Huang, Niels Dossche

ath11k_peer_find_by_addr states via lockdep that ab->base_lock must be
held when calling that function in order to protect the list. All
callers except ath11k_mac_op_unassign_vif_chanctx have that lock
acquired when calling ath11k_peer_find_by_addr. That lock is also not
transitively held by a path towards ath11k_mac_op_unassign_vif_chanctx.
The solution is to acquire the lock when calling
ath11k_peer_find_by_addr inside ath11k_mac_op_unassign_vif_chanctx.

Fixes: 701e48a43e15 ("ath11k: add packet log support for QCA6390")
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 07f499d5ec92..5db2333478a2 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -7077,9 +7077,15 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
 	WARN_ON(!arvif->is_started);
 
 	if (ab->hw_params.vdev_start_delay &&
-	    arvif->vdev_type == WMI_VDEV_TYPE_MONITOR &&
-	    ath11k_peer_find_by_addr(ab, ar->mac_addr))
-		ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr);
+	    arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {
+		struct ath11k_peer *peer;
+
+		spin_lock_bh(&ab->base_lock);
+		peer = ath11k_peer_find_by_addr(ab, ar->mac_addr);
+		spin_unlock_bh(&ab->base_lock);
+		if (peer)
+			ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr);
+	}
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {
 		ret = ath11k_mac_monitor_stop(ar);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-23  8:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-14 21:52 [PATCH] ath11k: acquire ab->base_lock in unassign when finding the peer by addr Niels Dossche
2022-03-16  6:13 ` Kalle Valo
2022-03-16 10:43   ` Niels Dossche
2022-03-16 14:34     ` Kalle Valo
2022-03-16 14:38       ` Niels Dossche
2022-03-21 10:45 ` Kalle Valo
2022-03-21 11:51   ` Niels Dossche
2022-03-23  8:52 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox