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

qcacld-3.0: Avoid large stack allocation in getPhyMode ioctl

The getPhyMode ioctl allocates a large struct on the stack. This is
problematic for a number of reasons, and can cause compilation errors.
Migrate the allocation to the heap instead.

Change-Id: I7a1df6bbc89dd169d11a541f1ebcded6136792e9
CRs-Fixed: 1114990
Dustin Brown преди 8 години
родител
ревизия
e9c6b3a24b
променени са 1 файла, в които са добавени 13 реда и са изтрити 4 реда
  1. 13 4
      core/hdd/src/wlan_hdd_wext.c

+ 13 - 4
core/hdd/src/wlan_hdd_wext.c

@@ -8140,17 +8140,26 @@ static int __iw_get_char_setnone(struct net_device *dev,
 		tHalHandle hal = WLAN_HDD_GET_HAL_CTX(pAdapter);
 		eCsrPhyMode phymode;
 		eCsrBand currBand;
-		tSmeConfigParams smeconfig;
+		tSmeConfigParams *sme_config;
 
-		sme_get_config_param(hal, &smeconfig);
+		sme_config = qdf_mem_malloc(sizeof(*sme_config));
+		if (!sme_config) {
+			hdd_err("Out of memory");
+			ret = -ENOMEM;
+			break;
+		}
+
+		sme_get_config_param(hal, sme_config);
 		if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
-		    smeconfig.csrConfig.channelBondingMode24GHz)
+		    sme_config->csrConfig.channelBondingMode24GHz)
 			ch_bond24 = true;
 
 		if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
-		    smeconfig.csrConfig.channelBondingMode5GHz)
+		    sme_config->csrConfig.channelBondingMode5GHz)
 			ch_bond5g = true;
 
+		qdf_mem_free(sme_config);
+
 		phymode = sme_get_phy_mode(hal);
 		if ((QDF_STATUS_SUCCESS !=
 		     sme_get_freq_band(hal, &currBand))) {