qcacld-3.0: Fix sta_info_container freed without init

Issue happens when wlan0 is created then hostapd change
it from sta to ap mode before start wlan0 adapter,
then interface is deleted; as hdd_sta_info_init only happens
when start ap adapter, so there will be issue when destroy
sta_obj_lock as sta_obj_lock was never init.

Change:
    Move init sta_info to open adapter and init sta_info
    for all modes, so this will simply the logic and
    no need to consider too much about adapter state change.

Change-Id: I5e90ec120b2ec487507d9bda2f8c18c9a54d2a01
CRs-Fixed: 2554812
This commit is contained in:
Jingxiang Ge 2020-01-10 10:04:29 +08:00 committed by nshrivas
parent 6dfe34582d
commit 6064426ef7
2 changed files with 6 additions and 23 deletions

View File

@ -3412,23 +3412,11 @@ QDF_STATUS hdd_init_ap_mode(struct hdd_adapter *adapter, bool reinit)
/* Initialize the data path module */
hdd_softap_init_tx_rx(adapter);
status = hdd_sta_info_init(&adapter->sta_info_list);
if (QDF_IS_STATUS_ERROR(status)) {
hdd_err("sta info init failed");
goto error_release_softap_tx_rx;
}
status = hdd_sta_info_init(&adapter->cache_sta_info_list);
if (QDF_IS_STATUS_ERROR(status)) {
hdd_err("cache sta info init failed");
goto error_release_sta_info;
}
status = hdd_wmm_adapter_init(adapter);
if (!QDF_IS_STATUS_SUCCESS(status)) {
hdd_err("hdd_wmm_adapter_init() failed code: %08d [x%08x]",
status, status);
goto error_release_wmm;
goto error_release_softap_tx_rx;
}
set_bit(WMM_INIT_DONE, &adapter->event_flags);
@ -3468,10 +3456,6 @@ QDF_STATUS hdd_init_ap_mode(struct hdd_adapter *adapter, bool reinit)
return status;
error_release_wmm:
hdd_sta_info_deinit(&adapter->cache_sta_info_list);
error_release_sta_info:
hdd_sta_info_deinit(&adapter->sta_info_list);
error_release_softap_tx_rx:
hdd_unregister_wext(adapter->dev);
hdd_softap_deinit_tx_rx(adapter);

View File

@ -5024,12 +5024,8 @@ static void hdd_cleanup_adapter(struct hdd_context *hdd_ctx,
qdf_mutex_destroy(&adapter->disconnection_status_lock);
hdd_apf_context_destroy(adapter);
qdf_spinlock_destroy(&adapter->vdev_lock);
if (adapter->device_mode == QDF_SAP_MODE ||
adapter->device_mode == QDF_P2P_GO_MODE) {
hdd_sta_info_deinit(&adapter->sta_info_list);
hdd_sta_info_deinit(&adapter->cache_sta_info_list);
}
hdd_sta_info_deinit(&adapter->sta_info_list);
hdd_sta_info_deinit(&adapter->cache_sta_info_list);
wlan_hdd_debugfs_csr_deinit(adapter);
if (adapter->device_mode == QDF_STA_MODE)
@ -5732,6 +5728,7 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio
INIT_WORK(&adapter->ipv6_notifier_work,
hdd_ipv6_notifier_work_queue);
#endif
break;
case QDF_FTM_MODE:
adapter = hdd_alloc_station_adapter(hdd_ctx, mac_addr,
@ -5774,6 +5771,8 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio
qdf_list_create(&adapter->blocked_scan_request_q, WLAN_MAX_SCAN_COUNT);
qdf_mutex_create(&adapter->blocked_scan_request_q_lock);
qdf_event_create(&adapter->acs_complete_event);
hdd_sta_info_init(&adapter->sta_info_list);
hdd_sta_info_init(&adapter->cache_sta_info_list);
if (QDF_STATUS_SUCCESS == status) {
/* Add it to the hdd's session list. */