[PATCH 0/2] wifi: ath9k: fix WMI command response handling
From: Michail Andreas Michalopoulos
Date: Tue Oct 20 2026 - 11:24:46 EST
Both patches fix the ath9k_htc WMI command response path.
Patch 1 stops ath9k_wmi_rsp_callback() from copying bytes the device
did not send. It replaces the -EMSGSIZE approach that was reverted in
commit 90201351a862: short and empty responses still complete, and the
rest of the caller's buffer is zeroed.
Patch 2 stops responses from being accepted while no command is pending
(after completion, after a failed send, or with sequence number 0),
which could make a duplicate response write into the stack frame of a
caller that has already returned.
Testing: temporary KUnit tests (not included) drive the real
ath9k_wmi_ctrl_rx() and ath9k_wmi_cmd() against a fake HTC device in
x86_64 QEMU under KASAN, KMSAN, UBSAN and lockdep: short and empty
responses for all payload/buffer length combinations, duplicate and
late responses, failed sends, sequence number wrap, and a concurrent
stress test. Without the patches stale bytes reach the caller and KASAN
reports slab-use-after-free writes in ath9k_wmi_ctrl_rx(); with them the
tests pass with no reports. Builds cleanly with W=1 (GCC and Clang) and
sparse.
I don't have access to an ath9k_htc device, so this was not tested on
hardware. Mehmet, if you could give it a try on your AR9271 that would
be much appreciated.
The series applies on top of v7.3, which contains the revert; ath.git
does not have the revert yet.
Michail Andreas Michalopoulos (2):
wifi: ath9k: don't read past short WMI command responses
wifi: ath9k: drop WMI command responses when no command is pending
drivers/net/wireless/ath/ath9k/wmi.c | 47 +++++++++++++++++++++++-----
1 file changed, 40 insertions(+), 7 deletions(-)
--
2.43.0