Răsfoiți Sursa

qcacld-3.0: Return error if channel list is NULL

Hostapd sends channel list as NULL in do_acs request
when country mode is set to world and hw mode is 11a.
This results in scan to be triggered on all 5g channels
and driver to choose 5g channel as best channel.

Fix is to return error to hostapd if channel list
received is NULL.

Change-Id: I17aacfdbeea9803023a66f54de7b596612ea97c3
CRs-Fixed: 2192858
Yeshwanth Sriram Guntuka 7 ani în urmă
părinte
comite
d1f8ca7325
1 a modificat fișierele cu 24 adăugiri și 19 ștergeri
  1. 24 19
      core/hdd/src/wlan_hdd_cfg80211.c

+ 24 - 19
core/hdd/src/wlan_hdd_cfg80211.c

@@ -2480,7 +2480,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
 	tsap_Config_t *sap_config;
 	struct sk_buff *temp_skbuff;
-	int status = -EINVAL, i = 0;
+	int ret, i;
 	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ACS_MAX + 1];
 	bool ht_enabled, ht40_enabled, vht_enabled;
 	uint8_t ch_width;
@@ -2508,19 +2508,19 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		return -EPERM;
 	}
 
-	status = wlan_hdd_validate_context(hdd_ctx);
-	if (status)
+	ret = wlan_hdd_validate_context(hdd_ctx);
+	if (ret)
 		goto out;
 
 	if (cds_is_sub_20_mhz_enabled()) {
 		hdd_err("ACS not supported in sub 20 MHz ch wd.");
-		status = -EINVAL;
+		ret = -EINVAL;
 		goto out;
 	}
 
 	if (qdf_atomic_inc_return(&hdd_ctx->is_acs_allowed) > 1) {
 		hdd_err("ACS rejected as previous req already in progress");
-		status = -EINVAL;
+		ret = -EINVAL;
 		goto out;
 	}
 
@@ -2529,10 +2529,10 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		qdf_mem_free(sap_config->acs_cfg.ch_list);
 	qdf_mem_zero(&sap_config->acs_cfg, sizeof(struct sap_acs_cfg));
 
-	status = wlan_cfg80211_nla_parse(tb, QCA_WLAN_VENDOR_ATTR_ACS_MAX, data,
+	ret = wlan_cfg80211_nla_parse(tb, QCA_WLAN_VENDOR_ATTR_ACS_MAX, data,
 					 data_len,
 					 wlan_hdd_cfg80211_do_acs_policy);
-	if (status) {
+	if (ret) {
 		hdd_err("Invalid ATTR");
 		qdf_atomic_set(&hdd_ctx->is_acs_allowed, 0);
 		goto out;
@@ -2540,7 +2540,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 
 	if (!tb[QCA_WLAN_VENDOR_ATTR_ACS_HW_MODE]) {
 		hdd_err("Attr hw_mode failed");
-		status = -EINVAL;
+		ret = -EINVAL;
 		qdf_atomic_set(&hdd_ctx->is_acs_allowed, 0);
 		goto out;
 	}
@@ -2624,7 +2624,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 					sap_config->acs_cfg.ch_list_count);
 			if (!sap_config->acs_cfg.ch_list) {
 				hdd_err("ACS config alloc fail");
-				status = -ENOMEM;
+				ret = -ENOMEM;
 				qdf_atomic_set(&hdd_ctx->is_acs_allowed, 0);
 				goto out;
 			}
@@ -2643,7 +2643,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 				sap_config->acs_cfg.ch_list_count);
 			if (!sap_config->acs_cfg.ch_list) {
 				hdd_err("ACS config alloc fail");
-				status = -ENOMEM;
+				ret = -ENOMEM;
 				qdf_atomic_set(&hdd_ctx->is_acs_allowed, 0);
 				goto out;
 			}
@@ -2655,6 +2655,11 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		}
 	}
 
+	if (!sap_config->acs_cfg.ch_list_count) {
+		ret = -EINVAL;
+		goto out;
+	}
+
 	hdd_debug("get pcl for DO_ACS vendor command");
 
 	/* consult policy manager to get PCL */
@@ -2684,18 +2689,18 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 
 	if (hdd_ctx->config->force_sap_acs) {
 		hdd_debug("forcing SAP acs start and end channel");
-		status = wlan_hdd_reset_force_acs_chan_range(hdd_ctx,
+		ret = wlan_hdd_reset_force_acs_chan_range(hdd_ctx,
 						sap_config);
-		if (status) {
+		if (ret) {
 			hdd_err("reset force acs channel range failed");
 			goto out;
 		}
 	}
 
 	sap_config->acs_cfg.band = hw_mode;
-	status = wlan_hdd_set_acs_ch_range(sap_config, hw_mode,
+	ret = wlan_hdd_set_acs_ch_range(sap_config, hw_mode,
 					   ht_enabled, vht_enabled);
-	if (status) {
+	if (ret) {
 		hdd_err("set acs channel range failed");
 		goto out;
 	}
@@ -2752,17 +2757,17 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		 */
 		set_bit(ACS_PENDING, &adapter->event_flags);
 		hdd_debug("ACS Pending for %s", adapter->dev->name);
-		status = 0;
+		ret = 0;
 	} else {
 		/* Check if vendor specific acs is enabled */
 		if (hdd_ctx->config->vendor_acs_support)
-			status = hdd_start_vendor_acs(adapter);
+			ret = hdd_start_vendor_acs(adapter);
 		else
-			status = wlan_hdd_cfg80211_start_acs(adapter);
+			ret = wlan_hdd_cfg80211_start_acs(adapter);
 	}
 
 out:
-	if (0 == status) {
+	if (ret == 0) {
 		temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
 							      NLMSG_HDRLEN);
 		if (temp_skbuff != NULL)
@@ -2771,7 +2776,7 @@ out:
 	wlan_hdd_undo_acs(adapter);
 	clear_bit(ACS_IN_PROGRESS, &hdd_ctx->g_event_flags);
 
-	return status;
+	return ret;
 }
 
 /**