Re: [PATCH] wifi: ath9k_htc: fix use-after-free of tx cleanup timer after failed start
From: Toke Høiland-Jørgensen
Date: Tue Nov 17 2026 - 05:27:41 EST
> ath9k_htc_start() does not treat a failure of
> ath9k_htc_update_cap_target() as fatal: it logs it at debug level and
> goes on to clear ATH_OP_INVALID, starts HTC, wakes the queues and arms
> priv->tx.cleanup_timer. It then returns the stale error code.
>
> mac80211 takes the failed drv_start() to mean the interface was not
> opened and never calls ath9k_htc_stop(), which is the only place the
> timer is deleted. The timer re-arms itself, so it is still pending when
> the device is unplugged and ath9k_htc_disconnect_device() frees the
> ieee80211_hw:
>
> ODEBUG: free active (active state 0) object: 000000002df157c8 object type: timer_list hint: ath9k_htc_tx_cleanup_timer+0x0/0x770 [ath9k_htc]
> WARNING: lib/debugobjects.c:629 at debug_print_object+0x1a4/0x3b0, CPU#2: kworker/2:2/110
> Workqueue: usb_hub_wq hub_event
> Call Trace:
> debug_check_no_obj_freed+0x44c/0x5b0
> __free_frozen_pages+0x724/0xed0
> device_release+0xcf/0x390
> kobject_put+0x19e/0x530
> ath9k_hif_usb_disconnect+0x371/0x540 [ath9k_htc]
> usb_unbind_interface+0x1a0/0x860
> device_release_driver_internal+0x35c/0x560
> bus_remove_device+0x28a/0x540
> device_del+0x371/0x930
> usb_disable_device+0x2ad/0x6a0
> usb_disconnect+0x27f/0x990
> hub_event+0x1bd5/0x3ad0
>
> Without debug objects the timer core later finds the freed timer in its
> wheel ("WARNING: kernel/time/timer.c ... !fn" in __run_timers()).
>
> The device is fully started at that point, so return 0. The interface
> then goes through the normal stop path, which deletes the timer.
>
> First seen with a TP-Link AR9271 adapter whose interface open failed.
> Reproduced on v7.4-rc2 with a USB proxy that withholds the reply to
> WMI_TARGET_IC_UPDATE_CMDID and then disconnects the device; with this
> change the same sequence produces no report.
>
> Fixes: 859c3ca1e460 ("ath9k_htc: Add a timer to cleanup WMI events")
The Fixes tag is wrong - this was introduced with the commit that moved the code
(which indeed didn't react to the ret value before):
Fixes: 1057b7503908 ("ath9k_htc: Unify target capability updating")
-Toke
--