Browse Source

qcacld-3.0: Revert wdev->mtx lock in channel switch

Revert wdev->mtx locking in commit
I0dd415a5576d29e3a7729768c8482205677ca3e7.
For STA eCSR_ROAM_STA_CHANNEL_SWITCH message, the sme_global_lock
is acquired in schedule thread alreadly. If we acquire wdev->mtx
in same thread, it will break the lock order and cause deadlock
issue. That is because the kernel -> Driver hdd request will
acquire wdev lock and then sme lock.

Change-Id: I6737040b596161c57589a5b2aac1a53754a8cba5
CRs-Fixed: 2862879
Liangwei Dong 4 years ago
parent
commit
7f80d9f64b
3 changed files with 6 additions and 16 deletions
  1. 1 3
      core/hdd/inc/wlan_hdd_main.h
  2. 1 2
      core/hdd/src/wlan_hdd_assoc.c
  3. 4 11
      core/hdd/src/wlan_hdd_hostapd.c

+ 1 - 3
core/hdd/inc/wlan_hdd_main.h

@@ -3564,7 +3564,6 @@ int hdd_update_components_config(struct hdd_context *hdd_ctx);
  * @dev:		Net device structure
  * @chan_change:	New channel change parameters
  * @legacy_phymode:	is the phymode legacy
- * @lock_wdev:  need wdev lock or not
  *
  * This function is used to notify hostapd about the channel change
  *
@@ -3574,8 +3573,7 @@ int hdd_update_components_config(struct hdd_context *hdd_ctx);
 QDF_STATUS hdd_chan_change_notify(struct hdd_adapter *adapter,
 		struct net_device *dev,
 		struct hdd_chan_change_params chan_change,
-		bool legacy_phymode,
-		bool lock_wdev);
+		bool legacy_phymode);
 int wlan_hdd_set_channel(struct wiphy *wiphy,
 		struct net_device *dev,
 		struct cfg80211_chan_def *chandef,

+ 1 - 2
core/hdd/src/wlan_hdd_assoc.c

@@ -4101,8 +4101,7 @@ static void hdd_roam_channel_switch_handler(struct hdd_adapter *adapter,
 		status = hdd_chan_change_notify(adapter, adapter->dev,
 						chan_change,
 						roam_info->mode ==
-						SIR_SME_PHY_MODE_LEGACY,
-						true);
+						SIR_SME_PHY_MODE_LEGACY);
 		if (QDF_IS_STATUS_ERROR(status))
 			hdd_err("channel change notification failed");
 	} else {

+ 4 - 11
core/hdd/src/wlan_hdd_hostapd.c

@@ -824,15 +824,13 @@ static int hdd_stop_bss_link(struct hdd_adapter *adapter)
 QDF_STATUS hdd_chan_change_notify(struct hdd_adapter *adapter,
 		struct net_device *dev,
 		struct hdd_chan_change_params chan_change,
-		bool legacy_phymode,
-		bool lock_wdev)
+		bool legacy_phymode)
 {
 	struct ieee80211_channel *chan;
 	struct cfg80211_chan_def chandef;
 	enum nl80211_channel_type channel_type;
 	uint32_t freq;
 	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
-	struct wireless_dev *wdev = dev->ieee80211_ptr;
 
 	if (!mac_handle) {
 		hdd_err("mac_handle is NULL");
@@ -901,15 +899,10 @@ QDF_STATUS hdd_chan_change_notify(struct hdd_adapter *adapter,
 				chan_change.chan_params.mhz_freq_seg0;
 	}
 
-	hdd_debug("notify: chan:%d width:%d freq1:%d freq2:%d locked %d",
+	hdd_debug("notify: chan:%d width:%d freq1:%d freq2:%d",
 		  chandef.chan->center_freq, chandef.width,
-		  chandef.center_freq1, chandef.center_freq2, lock_wdev);
-	if (lock_wdev)
-		mutex_lock(&wdev->mtx);
-
+		  chandef.center_freq1, chandef.center_freq2);
 	cfg80211_ch_switch_notify(dev, &chandef);
-	if (lock_wdev)
-		mutex_unlock(&wdev->mtx);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -1799,7 +1792,7 @@ static QDF_STATUS hdd_hostapd_chan_change(struct hdd_adapter *adapter,
 			sap_chan_selected->vht_seg1_center_ch_freq;
 
 	return hdd_chan_change_notify(adapter, adapter->dev,
-				      chan_change, legacy_phymode, false);
+				      chan_change, legacy_phymode);
 }
 
 QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,