ab->reg_info_store lives as long as the device. The first SERVICE_READY_EXT event allocates it, every later firmware start reuses it, the regulatory events keep the rules of each radio in it, and ath11k_reg_free() frees it together with those rules when the device is freed. Commit 64828f091c7d ("wifi: ath11k: fix reg_info_store leak in ath11k_service_ready_ext_event()") frees the store and clears the pointer on the SERVICE_READY_EXT error path. When the event fails after a firmware restart, that leaks the rules the store holds and leaves the store NULL while the radios stay registered with mac80211: ath11k_reg_handle_chan_list() then writes through the NULL pointer, and the 6 GHz paths of ath11k_mac_op_add_interface(), ath11k_mac_parse_tx_pwr_env() and ath11k_mac_op_sta_state() read through it. The leak that commit addressed, a store allocated by a first start that later fails, no longer needs it: ath11k_core_free() frees the regulatory state on every teardown path. Do not free the store on the error path. AI assistance was used. Fixes: 64828f091c7d ("wifi: ath11k: fix reg_info_store leak in ath11k_service_ready_ext_event()") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li --- Found by code review. Tested in QEMU with KASAN, using a test module that runs a SERVICE_READY_EXT and a regulatory event on a synthetic device and then restarts it with a failing SERVICE_READY_EXT: without this change the store pointer is cleared; with the series applied the store keeps the country code and the rule count of the first start. No new W=1, sparse or smatch warnings. drivers/net/wireless/ath/ath11k/wmi.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 08fd6795ed9e..bbca275a8289 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -5136,15 +5136,6 @@ static int ath11k_service_ready_ext_event(struct ath11k_base *ab, err: kfree(svc_rdy_ext.mac_phy_caps); - - /* - * During TLV iteration the WMI_TAG_SOC_HAL_REG_CAPABILITIES - * handler may have allocated ab->reg_info_store, so free it - * on error to avoid a memory leak - */ - kfree(ab->reg_info_store); - ab->reg_info_store = NULL; - ath11k_wmi_free_dbring_caps(ab); return ret; } -- 2.56.1