ソースを参照

qcacld-3.0: Use heap memory for station_info instead of stack

qcacld-2.0 to qcacld-3.0 propagation

From kernel 3.19-rc4, size of struct station_info is around 600 bytes,
so stack frame size of such routine use this struct will easily
exceed 1024 bytes, the default value of stack frame size.

So use heap memory for this struct instead.

Change-Id: Ibe8a4f5189fcc9d5554f7a5d851c93be8fa8dbad
CRs-Fixed: 1050323
Kai Liu 8 年 前
コミット
7400c5b0cc
1 ファイル変更10 行追加5 行削除
  1. 10 5
      core/hdd/src/wlan_hdd_assoc.c

+ 10 - 5
core/hdd/src/wlan_hdd_assoc.c

@@ -3292,7 +3292,7 @@ roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter,
 	{
 		hdd_station_ctx_t *pHddStaCtx =
 			WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-		struct station_info staInfo;
+		struct station_info *stainfo;
 
 		hdd_err("IBSS New Peer indication from SME "
 			 "with peerMac " MAC_ADDRESS_STR " BSSID: "
@@ -3322,13 +3322,18 @@ roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter,
 				qdf_status, qdf_status);
 		}
 		pHddStaCtx->ibss_sta_generation++;
-		memset(&staInfo, 0, sizeof(staInfo));
-		staInfo.filled = 0;
-		staInfo.generation = pHddStaCtx->ibss_sta_generation;
+		stainfo = qdf_mem_malloc(sizeof(*stainfo));
+		if (stainfo == NULL) {
+			hdd_err("memory allocation for station_info failed");
+			return QDF_STATUS_E_NOMEM;
+		}
+		stainfo->filled = 0;
+		stainfo->generation = pHddStaCtx->ibss_sta_generation;
 
 		cfg80211_new_sta(pAdapter->dev,
 				 (const u8 *)pRoamInfo->peerMac.bytes,
-				 &staInfo, GFP_KERNEL);
+				 stainfo, GFP_KERNEL);
+		qdf_mem_free(stainfo);
 
 		if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY ==
 		    pHddStaCtx->ibss_enc_key.encType