[PATCH ath-next v3 11/13] wifi: ath11k: free the queued QMI events when the QMI service is torn down

From: Julius Bairaktaris

Date: Sat Nov 21 2026 - 18:08:31 EST


ath11k_qmi_deinit_service() releases the QMI handle, cancels the event
work and destroys its workqueue, but frees no event still on
qmi->event_list. Releasing the handle reports the exit of every server
it knew, so ath11k_qmi_ops_del_server() queues a SERVER_EXIT event there
on every removal with a known server, and the event work stops early
once ATH11K_FLAG_UNREGISTERING is set and leaves the rest of the list.
These events are leaked.

Free the events left on the list once the handle is released and the
work is cancelled, when nothing can add or take one any more.

Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Julius Bairaktaris <julius@xxxxxxxxxxxxxx>
---
v3: new.

drivers/net/wireless/ath/ath11k/qmi.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index 3ce7c4e5c51c..4a3837958e01 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -3361,9 +3361,18 @@ int ath11k_qmi_init_service(struct ath11k_base *ab)

void ath11k_qmi_deinit_service(struct ath11k_base *ab)
{
+ struct ath11k_qmi_driver_event *event, *tmp;
+
qmi_handle_release(&ab->qmi.handle);
cancel_work_sync(&ab->qmi.event_work);
destroy_workqueue(ab->qmi.event_wq);
+
+ /* The handle is released and the work gone: free what is left */
+ list_for_each_entry_safe(event, tmp, &ab->qmi.event_list, list) {
+ list_del(&event->list);
+ kfree(event);
+ }
+
ath11k_qmi_m3_free(ab);
ath11k_qmi_free_target_mem_chunk(ab);
}
--
2.53.0