qcacmn: Fix deadlock due to peer_ref_mutex and scn_lock
Deadlock happens when control path takes scn_lock and calls
dp_peer_unref_delete() which in tern tries to acquire peer_ref_mutex.
At the same time, if other core starts handling peer_unmap by acquiring
peer_ref_mutex and calls dp_reset_and_release_peer_mem() which in turn
calls ol_ath_node_free() and tries to acquire scn_lock leading to a
deadlock.
Fix this by unlocking peer_ref_mutex before calling
dp_reset_and_release_peer_mem().
Change-Id: I343a8ef8f0914f9245a06b2818c9cbbe1db5218f
CRs-Fixed: 2449878
diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c
index e0a0a74..3c962fc 100644
--- a/dp/wifi3.0/dp_main.c
+++ b/dp/wifi3.0/dp_main.c
@@ -5655,7 +5655,9 @@
/* cleanup the peer data */
dp_peer_cleanup(vdev, peer);
+ qdf_spin_unlock_bh(&soc->peer_ref_mutex);
dp_reset_and_release_peer_mem(soc, pdev, peer, vdev);
+ qdf_spin_lock_bh(&soc->peer_ref_mutex);
/* check whether the parent vdev has no peers left */
if (TAILQ_EMPTY(&vdev->peer_list)) {