From 3ef62b974148bf7967551e26e90a4701e33c4f85 Mon Sep 17 00:00:00 2001 From: Jyoti Kumari Date: Fri, 6 Nov 2020 14:28:21 +0530 Subject: [PATCH] qcacld-3.0: Fix vdev null pointer access in disconnect handler Vdev is NULL before completion of hdd disconnect process Use hdd_objmgr_get_vdev() to get vdev reference and then pass it to ucfg_if_mgr_deliver_event(). After using, release the reference. Change-Id: I683851a2b7b4376440637edc70b7fdaf71acfbd0 CRs-Fixed: 2812480 --- core/hdd/src/wlan_hdd_assoc.c | 39 ++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index e80130f141d5..8d4c0e633fab 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -2030,6 +2030,28 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter, */ sta_ctx->hdd_reassoc_scenario = false; + /* + * Following code will be cleaned once the interface manager + * module is enabled. + */ +#ifdef WLAN_FEATURE_INTERFACE_MGR + vdev = hdd_objmgr_get_vdev(adapter); + if (vdev) { + ucfg_if_mgr_deliver_event(vdev, + WLAN_IF_MGR_EV_DISCONNECT_COMPLETE, + NULL); + hdd_objmgr_put_vdev(vdev); + } +#else + if (policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc) && + QDF_STA_MODE == adapter->device_mode) { + sme_enable_roaming_on_connected_sta(mac_handle, + adapter->vdev_id); + policy_mgr_set_pcl_for_connected_vdev(hdd_ctx->psoc, + adapter->vdev_id, true); + } +#endif + /* Unblock anyone waiting for disconnect to complete */ complete(&adapter->disconnect_comp_var); @@ -2041,23 +2063,6 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter, hdd_print_bss_info(sta_ctx); - /* - * Following code will be cleaned once the interface manager - * module is enabled. - */ -#ifdef WLAN_FEATURE_INTERFACE_MGR - ucfg_if_mgr_deliver_event(adapter->vdev, - WLAN_IF_MGR_EV_DISCONNECT_COMPLETE, NULL); -#else - if (policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc) && - QDF_STA_MODE == adapter->device_mode) { - sme_enable_roaming_on_connected_sta(mac_handle, - adapter->vdev_id); - policy_mgr_set_pcl_for_connected_vdev(hdd_ctx->psoc, - adapter->vdev_id, true); - } -#endif - return status; }