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
This commit is contained in:
Jyoti Kumari 2020-11-06 14:28:21 +05:30 • committed by Gerrit - the friendly Code Review server
commit 3ef62b9741

View file

@ -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;
}