103 lines
4.0 KiB
Diff
103 lines
4.0 KiB
Diff
From: Pedro Perez de Heredia <pedro.perez@digi.com>
|
|
Date: Mon, 13 Feb 2017 10:28:35 +0100
|
|
Subject: [PATCH] kernel-module-qualcomm: fix issue with _scan_callback at
|
|
module unload
|
|
|
|
Protect the invocation of the _scan_done() callback function with the
|
|
global lock to avoid that it is called while the module is being unloaded
|
|
and the data structures have been freed.
|
|
|
|
https://jira.digi.com/browse/DEL-3607
|
|
https://jira.digi.com/browse/DEL-3393
|
|
|
|
Signed-off-by: Pedro Perez de Heredia <pedro.perez@digi.com>
|
|
---
|
|
CORE/SME/src/csr/csrApiScan.c | 43 +++++++++++++++++++++++++++++--------------
|
|
1 file changed, 29 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c
|
|
index 83a74cb..2f90cce 100644
|
|
--- a/CORE/SME/src/csr/csrApiScan.c
|
|
+++ b/CORE/SME/src/csr/csrApiScan.c
|
|
@@ -6420,13 +6420,20 @@ eHalStatus csrScanFreeRequest(tpAniSirGlobal pMac, tCsrScanRequest *pReq)
|
|
|
|
void csrScanCallCallback(tpAniSirGlobal pMac, tSmeCmd *pCommand, eCsrScanStatus scanStatus)
|
|
{
|
|
- if(pCommand->u.scanCmd.callback)
|
|
+ eHalStatus status;
|
|
+
|
|
+ status = sme_AcquireGlobalLock( &pMac->sme );
|
|
+ if ( HAL_STATUS_SUCCESS( status ) )
|
|
{
|
|
- pCommand->u.scanCmd.callback(pMac, pCommand->u.scanCmd.pContext,
|
|
- pCommand->sessionId,
|
|
- pCommand->u.scanCmd.scanID, scanStatus);
|
|
- } else {
|
|
- smsLog( pMac, LOG2, "%s:%d - Callback NULL!!!", __func__, __LINE__);
|
|
+ if(pCommand->u.scanCmd.callback)
|
|
+ {
|
|
+ pCommand->u.scanCmd.callback(pMac, pCommand->u.scanCmd.pContext,
|
|
+ pCommand->sessionId,
|
|
+ pCommand->u.scanCmd.scanID, scanStatus);
|
|
+ } else {
|
|
+ smsLog( pMac, LOG2, "%s:%d - Callback NULL!!!", __func__, __LINE__);
|
|
+ }
|
|
+ sme_ReleaseGlobalLock( &pMac->sme );
|
|
}
|
|
}
|
|
|
|
@@ -7126,6 +7133,7 @@ tANI_BOOLEAN csrScanRemoveFreshScanCommand(tpAniSirGlobal pMac, tANI_U8 sessionI
|
|
tSmeCmd *pCommand;
|
|
tDblLinkList localList;
|
|
tDblLinkList *pCmdList;
|
|
+ eHalStatus status;
|
|
|
|
vos_mem_zero(&localList, sizeof(tDblLinkList));
|
|
if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
|
|
@@ -7178,15 +7186,21 @@ tANI_BOOLEAN csrScanRemoveFreshScanCommand(tpAniSirGlobal pMac, tANI_U8 sessionI
|
|
while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
|
|
{
|
|
pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
|
|
- if (pCommand->u.scanCmd.callback)
|
|
+
|
|
+ status = sme_AcquireGlobalLock( &pMac->sme );
|
|
+ if ( HAL_STATUS_SUCCESS( status ) )
|
|
{
|
|
- /* User scan request is pending,
|
|
+ if (pCommand->u.scanCmd.callback)
|
|
+ {
|
|
+ /* User scan request is pending,
|
|
* send response with status eCSR_SCAN_ABORT*/
|
|
- pCommand->u.scanCmd.callback(pMac,
|
|
- pCommand->u.scanCmd.pContext,
|
|
- sessionId,
|
|
- pCommand->u.scanCmd.scanID,
|
|
- eCSR_SCAN_ABORT);
|
|
+ pCommand->u.scanCmd.callback(pMac,
|
|
+ pCommand->u.scanCmd.pContext,
|
|
+ sessionId,
|
|
+ pCommand->u.scanCmd.scanID,
|
|
+ eCSR_SCAN_ABORT);
|
|
+ }
|
|
+ sme_ReleaseGlobalLock( &pMac->sme );
|
|
}
|
|
csrReleaseCommandScan( pMac, pCommand );
|
|
}
|
|
@@ -8015,7 +8029,6 @@ eHalStatus csrProcessSetBGScanParam(tpAniSirGlobal pMac, tSmeCmd *pCommand)
|
|
return (status);
|
|
}
|
|
|
|
-
|
|
eHalStatus csrScanAbortMacScan(tpAniSirGlobal pMac, tANI_U8 sessionId,
|
|
eCsrAbortReason reason)
|
|
{
|
|
@@ -8035,6 +8048,8 @@ eHalStatus csrScanAbortMacScan(tpAniSirGlobal pMac, tANI_U8 sessionId,
|
|
{
|
|
|
|
pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
|
|
+ pCommand->u.scanCmd.callback = NULL;
|
|
+ pCommand->u.scanCmd.pContext = NULL;
|
|
csrAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE);
|
|
}
|
|
csrLLUnlock(&pMac->scan.scanCmdPendingList);
|