Преглед на файлове

qcacld-3.0: Channel width check for set bandwidth

User space use enum nl80211_chan_width for the attribute value.
When set 320 MHz bandwidth, driver check the channel width range
failed.

Change-Id: Ia14427fc68ac8abdcedcb21748f5bce2e1ec7c33
CRs-Fixed: 3615838
Chunquan Luo преди 1 година
родител
ревизия
f9273f8d34
променени са 1 файла, в които са добавени 8 реда и са изтрити 9 реда
  1. 8 9
      core/hdd/src/wlan_hdd_cfg80211.c

+ 8 - 9
core/hdd/src/wlan_hdd_cfg80211.c

@@ -11028,12 +11028,13 @@ static int hdd_set_channel_width(struct wlan_hdd_link_info *link_info,
 		mlo_link_id = tb2[QCA_WLAN_VENDOR_ATTR_CONFIG_MLO_LINK_ID];
 
 		if (!chn_bd || !mlo_link_id)
-			return 0;
+			return -EINVAL;
 
 		nl80211_chwidth = nla_get_u8(chn_bd);
-		if (nl80211_chwidth < eHT_CHANNEL_WIDTH_20MHZ ||
-		    nl80211_chwidth > eHT_MAX_CHANNEL_WIDTH) {
-			hdd_err("Invalid channel width:%u", nl80211_chwidth);
+		chwidth = hdd_nl80211_chwidth_to_chwidth(nl80211_chwidth);
+		if (chwidth < eHT_CHANNEL_WIDTH_20MHZ ||
+		    chwidth >= eHT_MAX_CHANNEL_WIDTH) {
+			hdd_err("Invalid channel width:%u", chwidth);
 			return -EINVAL;
 		}
 
@@ -11051,19 +11052,17 @@ skip_mlo:
 	chn_bd = tb[QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_WIDTH];
 
 	if (!chn_bd)
-		return 0;
+		return -EINVAL;
 
 	nl80211_chwidth = nla_get_u8(chn_bd);
-
-set_chan_width:
 	chwidth = hdd_nl80211_chwidth_to_chwidth(nl80211_chwidth);
 
 	if (chwidth < eHT_CHANNEL_WIDTH_20MHZ ||
-	    chwidth > eHT_MAX_CHANNEL_WIDTH) {
+	    chwidth >= eHT_MAX_CHANNEL_WIDTH) {
 		hdd_err("Invalid channel width %u", chwidth);
 		return -EINVAL;
 	}
-
+set_chan_width:
 	return hdd_set_mac_chan_width(link_info->adapter,
 				      chwidth, link_id);
 }