From: Zhao Li <enderaoelyther@gmail.com>
To: Jeff Johnson <jjohnson@kernel.org>
Cc: Kalle Valo <kvalo@kernel.org>, Wen Gong <quic_wgong@quicinc.com>,
Baochen Qiang <baochen.qiang@oss.qualcomm.com>,
Anilkumar Kolli <quic_akolli@quicinc.com>,
linux-wireless@vger.kernel.org, ath11k@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Zhao Li <enderaoelyther@gmail.com>
Subject: [PATCH ath-current 3/3] wifi: ath11k: keep the regulatory info store on a SERVICE_READY_EXT error
Date: Wed, 18 Nov 2026 23:29:42 +0800 [thread overview]
Message-ID: <20261118152942.62838-4-enderaoelyther@gmail.com> (raw)
In-Reply-To: <20261118152942.62838-1-enderaoelyther@gmail.com>
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 <enderaoelyther@gmail.com>
---
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
prev parent reply other threads:[~2026-11-18 15:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 15:29 [PATCH ath-current 0/3] wifi: ath11k: give the regulatory state the lifetime of the device Zhao Li
2026-11-18 15:29 ` [PATCH ath-current 1/3] wifi: ath11k: don't walk an unallocated regulatory info store Zhao Li
2026-11-18 15:29 ` [PATCH ath-current 2/3] wifi: ath11k: free the regulatory state when the device is freed Zhao Li
2026-11-18 15:29 ` Zhao Li [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261118152942.62838-4-enderaoelyther@gmail.com \
--to=enderaoelyther@gmail.com \
--cc=ath11k@lists.infradead.org \
--cc=baochen.qiang@oss.qualcomm.com \
--cc=jjohnson@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_akolli@quicinc.com \
--cc=quic_wgong@quicinc.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.