浏览代码

qcacld-3.0: Fix mem leak in SAP SSR

Fix a memory leak observed if SAP restart fails after SSR.

Change-Id: I868b20972e4b78b6f6c89a26fc41ad10161c239c
CRs-fixed: 2060614
Manikandan Mohan 7 年之前
父节点
当前提交
3dad1a4869
共有 2 个文件被更改,包括 14 次插入5 次删除
  1. 7 3
      core/hdd/src/wlan_hdd_main.c
  2. 7 2
      core/sap/src/sap_module.c

+ 7 - 3
core/hdd/src/wlan_hdd_main.c

@@ -4123,10 +4123,9 @@ QDF_STATUS hdd_stop_adapter(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
 			}
 			/* Reset WNI_CFG_PROBE_RSP Flags */
 			wlan_hdd_reset_prob_rspies(adapter);
-			qdf_mem_free(adapter->sessionCtx.ap.beacon);
-			adapter->sessionCtx.ap.beacon = NULL;
 		}
-
+		qdf_mem_free(adapter->sessionCtx.ap.beacon);
+		adapter->sessionCtx.ap.beacon = NULL;
 		/*
 		 * If Do_Not_Break_Stream was enabled clear avoid channel list.
 		 */
@@ -10349,6 +10348,11 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter, bool reinit)
 
 end:
 	mutex_unlock(&hdd_ctx->sap_lock);
+	/* SAP context and beacon cleanup will happen during driver unload
+	 * in hdd_stop_adapter
+	 */
+	hdd_err("SAP restart after SSR failed! Reload WLAN and try SAP again");
+
 }
 
 /**

+ 7 - 2
core/sap/src/sap_module.c

@@ -906,14 +906,16 @@ QDF_STATUS wlansap_start_bss(void *pCtx,     /* pwextCtx */
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
 			  "%s: Invalid MAC context from p_cds_gctx",
 			  __func__);
-		return QDF_STATUS_E_FAULT;
+		qdf_status = QDF_STATUS_E_FAULT;
+		goto fail;
 	}
 	pmac = PMAC_STRUCT(hHal);
 	if (NULL == pmac) {
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
 			  "%s: Invalid MAC context from p_cds_gctx",
 			  __func__);
-		return QDF_STATUS_E_FAULT;
+		qdf_status = QDF_STATUS_E_FAULT;
+		goto fail;
 	}
 	/* If concurrent session is running that is already associated
 	 * then we just follow that sessions country info (whether
@@ -960,6 +962,9 @@ QDF_STATUS wlansap_start_bss(void *pCtx,     /* pwextCtx */
 
 	/* Handle event */
 	qdf_status = sap_fsm(pSapCtx, &sapEvent);
+fail:
+	if (QDF_IS_STATUS_ERROR(qdf_status))
+		sap_free_roam_profile(&pSapCtx->csr_roamProfile);
 
 	return qdf_status;
 } /* wlansap_start_bss */