Browse Source

qcacld-3.0: Fix locking order in ol_txrx_disp_peer_stats()

Fix the locking order of pdev->peer_ref_mutex and pdev->local_peer_ids.lock
spin_locks in ol_txrx_disp_peer_stats(), this was resulting in deadlock
with lock order in ol_txrx_peer_get_ref_by_local_id().

Change-Id: I51d39daed7f8fb04c30fd6a73e2f9ca388543620
CRs-Fixed: 2315808
Manjunathappa Prakash 6 years ago
parent
commit
a4272ab881
1 changed files with 2 additions and 2 deletions
  1. 2 2
      core/dp/txrx/ol_txrx.c

+ 2 - 2
core/dp/txrx/ol_txrx.c

@@ -4067,14 +4067,14 @@ static void ol_txrx_disp_peer_stats(ol_txrx_pdev_handle pdev)
 		return;
 
 	for (i = 0; i < OL_TXRX_NUM_LOCAL_PEER_IDS; i++) {
+		qdf_spin_lock_bh(&pdev->peer_ref_mutex);
 		qdf_spin_lock_bh(&pdev->local_peer_ids.lock);
 		peer = pdev->local_peer_ids.map[i];
 		if (peer) {
-			qdf_spin_lock_bh(&pdev->peer_ref_mutex);
 			ol_txrx_peer_get_ref(peer, PEER_DEBUG_ID_OL_INTERNAL);
-			qdf_spin_unlock_bh(&pdev->peer_ref_mutex);
 		}
 		qdf_spin_unlock_bh(&pdev->local_peer_ids.lock);
+		qdf_spin_unlock_bh(&pdev->peer_ref_mutex);
 
 		if (peer) {
 			txrx_nofl_info("stats: peer 0x%pK local peer id %d",