wifi: ath9k: delete channel-context timers on deinit
PATCH v2 1/1 wifi: ath9k: delete channel-context timers on deinit
ath9k_deinit_channel_context() cancels chanctx_work but does not delete the offchannel and sched timers set up by ath9k_init_channel_context(). If either timer fires after deinit (e.g. during driver unload or suspend), it accesses sc->sc_ah which may already be freed by ath9k_hw_deinit(), causing a use-after-free.
Delete both timers with timer_shutdown_sync() before cancelling the work item.
---
v2: use timer_shutdown_sync()
drivers/net/wireless/ath/ath9k/channel.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath9k/channel.c +2 -0
@@ -1363,6 +1363,8 @@ void ath9k_init_channel_context(struct ath_softc *sc)void ath9k_deinit_channel_context (struct ath_softc *sc) { +timer_shutdown_sync (&sc->sched.timer); +timer_shutdown_sync (&sc->offchannel.timer);cancel_work_sync (&sc->chanctx_work); }
Signature · 1 line
2.55.0
Quoted 11 lines · Rosen Penev
ath9k_deinit_channel_context()cancelschanctx_workbut does not delete the offchannel and sched timers set up byath9k_init_channel_context(). If either timer fires after deinit (e.g. during driver unload or suspend), it accessessc->sc_ahwhich may already be freed byath9k_hw_deinit(), causing a use-after-free.Delete both timers with
timer_shutdown_sync()before cancelling the work item.Assisted-by LLMSigned-off-by Rosen Penev <[email protected]>
Quoted 8 lines · Toke Høiland-Jørgensen
Quoted 6 lines · Rosen Penev
ath9k_deinit_channel_context()cancelschanctx_workbut does not delete the offchannel and sched timers set up byath9k_init_channel_context(). If either timer fires after deinit (e.g. during driver unload or suspend), it accessessc->sc_ahwhich may already be freed byath9k_hw_deinit(), causing a use-after-free.
Quoted 7 lines
Quoted 5 lines
Delete both timers with
timer_shutdown_sync()before cancelling the work item.Assisted-by LLMSigned-off-by Rosen Penev <[email protected]>
I'm picking this up now. Will add the following suggested by my review agent:
Jeff Johnson
AppliedQuoted 10 lines · Rosen Penev
ath9k_deinit_channel_context()cancelschanctx_workbut does not delete the offchannel and sched timers set up byath9k_init_channel_context(). If either timer fires after deinit (e.g. during driver unload or suspend), it accessessc->sc_ahwhich may already be freed byath9k_hw_deinit(), causing a use-after-free.Delete both timers with
timer_shutdown_sync()before cancelling the work item.[...]
Applied, thanks!
[1/1] wifi: ath9k: delete channel-context timers on deinit
commit: 81394dfb9a7905472957628b560ae894eae3a30f
Best regards,
Signature · 1 line
Jeff Johnson <[email protected]>