From e7f590350c01c23febd4aac6dd2129d493e24754 Mon Sep 17 00:00:00 2001 From: Pedro Perez de Heredia Date: Mon, 13 Feb 2017 10:57:07 +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. Additionally, the commit also adds a patch to reduce the log level of the driver that is logging some annoying messages. https://jira.digi.com/browse/DEL-3607 https://jira.digi.com/browse/DEL-3393 Signed-off-by: Pedro Perez de Heredia --- .../kernel-module-qualcomm.bb | 2 + .../0021-cosmetic-change-log-level.patch | 53 +++++++++ .../0022-fix-issue-with-_scan_callback.patch | 102 ++++++++++++++++++ 3 files changed, 157 insertions(+) create mode 100644 meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0021-cosmetic-change-log-level.patch create mode 100644 meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0022-fix-issue-with-_scan_callback.patch diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb index 1ef977f14..afe55d0dc 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb @@ -34,6 +34,8 @@ SRC_URI = " \ file://0018-qcacld-Indicate-disconnect-event-to-upper-layers.patch \ file://0019-wdd_hdd_main-Print-con_mode-to-clearly-see-if-in-FTM.patch \ file://0020-Makefile-Pass-BUILD_DEBUG_VERSION-to-kbuild-system.patch \ + file://0021-cosmetic-change-log-level.patch \ + file://0022-fix-issue-with-_scan_callback.patch \ " S = "${WORKDIR}/${PV}" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0021-cosmetic-change-log-level.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0021-cosmetic-change-log-level.patch new file mode 100644 index 000000000..2b2c6c8fb --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0021-cosmetic-change-log-level.patch @@ -0,0 +1,53 @@ +From: Pedro Perez de Heredia +Date: Mon, 13 Feb 2017 09:43:50 +0100 +Subject: [PATCH] kernel-module-qualcomm: cosmetic change log level for anoying + driver messages + +Signed-off-by: Pedro Perez de Heredia +--- + CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c | 4 ++-- + CORE/SVC/src/logging/wlan_logging_sock_svc.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c +index 1a1e51e..ee2af05 100644 +--- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c ++++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c +@@ -1202,7 +1202,7 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe + clock = device->host->f_max; + } + +- printk(KERN_ERR "%s: Dumping clocks (%d,%d)\n", __func__, func->card->cis.max_dtr, device->host->f_max); ++ pr_info("%s: Dumping clocks (%d,%d)\n", __func__, func->card->cis.max_dtr, device->host->f_max); + + /* + // We don't need to set the clock explicitly on 8064/ADP platforms. +@@ -1513,7 +1513,7 @@ static A_STATUS hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func) + sdio_release_host(func); + return A_ERROR; + } +- printk(KERN_ERR"AR6000: Set async interrupt delay clock as %d.\n", asyncintdelay); ++ pr_info("AR6000: Set async interrupt delay clock as %d.\n", asyncintdelay); + } + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +diff --git a/CORE/SVC/src/logging/wlan_logging_sock_svc.c b/CORE/SVC/src/logging/wlan_logging_sock_svc.c +index 0253215..379d878 100644 +--- a/CORE/SVC/src/logging/wlan_logging_sock_svc.c ++++ b/CORE/SVC/src/logging/wlan_logging_sock_svc.c +@@ -431,13 +431,13 @@ static int wlan_logging_thread(void *Arg) + || gwlan_logging.exit)); + + if (ret_wait_status == -ERESTARTSYS) { +- pr_err("%s: wait_event_interruptible returned -ERESTARTSYS", ++ pr_info("%s: wait_event_interruptible returned -ERESTARTSYS", + __func__); + break; + } + + if (gwlan_logging.exit) { +- pr_err("%s: Exiting the thread\n", __func__); ++ pr_info("%s: Exiting the thread\n", __func__); + break; + } + diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0022-fix-issue-with-_scan_callback.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0022-fix-issue-with-_scan_callback.patch new file mode 100644 index 000000000..6f1f6fb51 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0022-fix-issue-with-_scan_callback.patch @@ -0,0 +1,102 @@ +From: Pedro Perez de Heredia +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 +--- + 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);