Sfoglia il codice sorgente

qcacld-3.0: Release sapctx in all cases when sap close is requested

Present wlansap_close API walks out without releasing the sapctx when
hal context is null which creates the memory leak.

Release sapctx in all cases when caller requests to close the
sap session.

CRs-Fixed: 2040045
Change-Id: I3c8f0a33c11de9d88d6b29f726f36a838f2428d2
Krunal Soni 8 anni fa
parent
commit
0bdfc7716c
1 ha cambiato i file con 6 aggiunte e 8 eliminazioni
  1. 6 8
      core/sap/src/sap_module.c

+ 6 - 8
core/sap/src/sap_module.c

@@ -487,17 +487,15 @@ QDF_STATUS wlansap_close(void *pCtx)
 			  "%s: Invalid SAP pointer from pCtx", __func__);
 		return QDF_STATUS_E_FAULT;
 	}
-	hal = CDS_GET_HAL_CB(pSapCtx->p_cds_gctx);
-	if (!hal) {
-		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
-			  FL("Invalid hal pointer"));
-		return QDF_STATUS_E_FAULT;
-	}
 	/* Cleanup SAP control block */
 	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG, FL("Enter"));
 	sap_cleanup_channel_list(pCtx);
-	/* empty queues/lists/pkts if any */
-	if (pSapCtx->sessionId != CSR_SESSION_ID_INVALID)
+	hal = CDS_GET_HAL_CB(pSapCtx->p_cds_gctx);
+	if (!hal)
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
+			  FL("hal is NULL, so lets skip global sap cleanup"));
+	else if (pSapCtx->sessionId != CSR_SESSION_ID_INVALID)
+		/* empty queues/lists/pkts if any */
 		sap_clear_session_param(hal, pSapCtx, pSapCtx->sessionId);
 	/*
 	 * wlansap_context_put will release actual pSapCtx memory