diff options
| author | Sachin Ahuja <sahuja@qti.qualcomm.com> | 2016-03-17 17:10:45 +0530 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2016-03-18 15:39:25 +0530 |
| commit | 3080aab62dc4883850bd3ab112f3491cbee7326e (patch) | |
| tree | 217089d95a42b7ccc0b26b96e74c89029e0b0602 | |
| parent | 882d231f3d313485b0be45660a33017ce73de8fd (diff) | |
qcacld-2.0: Deinit memdump only when it is initialized
During driver initialization, if hif_register_driver timeout
then memdump is not initialized. Due to this timeout, unregister
driver is called which deinitialize memdump which cause crash as
uninitialized mutex is accessed in memdump_deinit.
To fix this issue, deinit memdump only when the init is successful.
Change-Id: I781717a2a160aa09c9f60ebface1238507d1a623
CRs-Fixed: 991443
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_main.h | 1 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_memdump.c | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h index 3971dcf22e9c..0abf3ecb7af4 100644 --- a/CORE/HDD/inc/wlan_hdd_main.h +++ b/CORE/HDD/inc/wlan_hdd_main.h @@ -1709,6 +1709,7 @@ struct hdd_context_s vos_timer_t memdump_cleanup_timer; struct mutex memdump_lock; bool memdump_in_progress; + bool memdump_init_done; #endif /* WLAN_FEATURE_MEMDUMP */ uint16_t driver_dump_size; uint8_t *driver_dump_mem; diff --git a/CORE/HDD/src/wlan_hdd_memdump.c b/CORE/HDD/src/wlan_hdd_memdump.c index 6cc84d264e3f..359cd8d9c5bb 100644 --- a/CORE/HDD/src/wlan_hdd_memdump.c +++ b/CORE/HDD/src/wlan_hdd_memdump.c @@ -592,6 +592,7 @@ int memdump_init(void) } mutex_init(&hdd_ctx->memdump_lock); + hdd_ctx->memdump_init_done = true; return 0; } @@ -628,6 +629,12 @@ void memdump_deinit(void) { return; } + if (!hdd_ctx->memdump_init_done) { + hddLog(LOGE, FL("MemDump not initialized")); + return; + } + + hdd_ctx->memdump_init_done = false; adf_ctx = vos_get_context(VOS_MODULE_ID_ADF, hdd_ctx->pvosContext); if (!adf_ctx) { hddLog(LOGE, FL("ADF context is NULL")); @@ -645,7 +652,9 @@ void memdump_deinit(void) { hdd_ctx->fw_dump_loc = NULL; hdd_ctx->memdump_in_progress = false; } + mutex_unlock(&hdd_ctx->memdump_lock); + mutex_destroy(&hdd_ctx->memdump_lock); if (VOS_TIMER_STATE_RUNNING == vos_timer_getCurrentState(&hdd_ctx->memdump_cleanup_timer)) { |
