summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandrasekaran, Manishekar <cmshekar@qti.qualcomm.com>2014-07-21 14:10:09 +0530
committerAkash Patel <c_akashp@qca.qualcomm.com>2014-07-25 10:37:01 -0700
commitc95b8e89ddde84686dc2d861224767f7ce948a97 (patch)
tree0d72227b68d95c09262fd5569d705251ed59dcd2
parentec12be97f99b225a78da9eeda7b92b1d34484cb6 (diff)
qcacld: Fix for driver crash when invalid country code is set
Currently, when the driver initialization fails, all the clean up operations are performed during startup. But, again the platform invokes the exit function where a few repeated cleanup operation are performed. Along with this, some of the NULL pointers are getting dereferenced. So, in this fix, if the clean up operations are already complete, the exit function is not invoked again and only the minimal cleanup required is done. CRs-Fixed: 694637 Change-Id: I4c321787327c33d089f77ed12935e65db080e603
-rw-r--r--CORE/HDD/inc/wlan_hdd_main.h2
-rwxr-xr-xCORE/HDD/src/wlan_hdd_main.c20
2 files changed, 20 insertions, 2 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index 0e65ccebb277..570823d02c0b 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -1317,6 +1317,8 @@ struct hdd_context_s
v_BOOL_t isUnloadInProgress;
+ v_BOOL_t isCleanUpDone;
+
/**Track whether driver has been suspended.*/
hdd_ps_state_t hdd_ps_state;
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 95d9d583493e..b368854b4e48 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -10778,8 +10778,21 @@ void __hdd_wlan_exit(void)
wlan_hdd_send_status_pkg(NULL, NULL, 0, 0);
#endif
- //Do all the cleanup before deregistering the driver
- hdd_wlan_exit(pHddCtx);
+ if (pHddCtx->isCleanUpDone == FALSE ) {
+ /* Do all the cleanup before deregistering the driver */
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: Cleaning up before driver deregistration",
+ __func__);
+ hdd_wlan_exit(pHddCtx);
+ } else {
+ /* This means driver loading has failed. Major cleanup
+ * is already done as part of driver load failure.
+ */
+ struct wiphy *wiphy = pHddCtx->wiphy;
+ hdd_close_all_adapters( pHddCtx );
+ wiphy_free(wiphy);
+ }
+
EXIT();
}
#endif /* QCA_WIFI_2_0 && !QCA_WIFI_ISOC */
@@ -11469,6 +11482,7 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc)
pHddCtx->wiphy = wiphy;
hdd_prevent_suspend();
pHddCtx->isLoadInProgress = TRUE;
+ pHddCtx->isCleanUpDone = FALSE;
pHddCtx->ioctl_scan_mode = eSIR_ACTIVE_SCAN;
vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, TRUE);
@@ -12449,6 +12463,8 @@ err_free_hdd_context:
}
hdd_set_ssr_required (VOS_FALSE);
+ pHddCtx->isCleanUpDone = TRUE;
+
return -EIO;
success: