qcacld-3.0: Use delete safe loop to remove sta info

Presently, in hdd_reset_all_adapters, the removal of the sta_info
structures via hdd_deregister_sta happens inside a loop that is not safe
for removal. This can cause various potential invalid memory access from
use-after-free to null-dereference.

To rectify this, use the delete safe API to loop over the sta info
entries.

Change-Id: I3d5526af8d8f819874f6bcffabf27ceb74f6f32a
CRs-Fixed: 2557364
This commit is contained in:
Sourav Mohapatra 2019-11-01 09:29:16 +05:30 • committed by nshrivas
commit e14c24792e

View file

@ -6161,6 +6161,7 @@ QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx)
struct wlan_objmgr_vdev *vdev;
uint8_t index = 0;
struct hdd_station_info *sta_info;
struct hdd_sta_info_entry *tmp;
hdd_enter();
@ -6273,8 +6274,8 @@ QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx)
&adapter->event_flags);
/* Loop over and deregister every registered peer */
hdd_for_each_station(adapter->sta_info_list, sta_info,
index) {
hdd_for_each_station_safe(adapter->sta_info_list,
sta_info, index, tmp) {
hdd_debug("[SSR] deregister STA MAC:"
QDF_MAC_ADDR_STR, QDF_MAC_ADDR_ARRAY(
sta_info->sta_mac.bytes));