Re: [PATCH v2] wifi: mm81x: prevent timers from outliving teardown

From: Dan Callaghan

Date: Thu Jul 30 2026 - 20:14:22 EST


Excerpts from Linmao Li's message of 2026-07-23 19:39:27 +0800:
> The three timer teardown paths call timer_delete_sync_try() and ignore
> its return value. If a callback is running on another CPU it returns -1
> without waiting, and it does not prevent a later rearm even when it does
> deactivate a pending timer. mm81x_skbq_tx_complete() can rearm the
> stale-status timer, and the rc and yaps callbacks queue work that rearms
> their timers. Teardown can therefore continue with a callback still
> running or the timer rearmed, so it fires after the associated state has
> been freed.
>
> Use timer_shutdown_sync() for these permanent teardowns: it waits for an
> in-flight callback and prevents any future rearm. In mm81x_rc_deinit()
> shut the timer down before cancel_work_sync() so the work can no longer
> recreate the timer/work cycle.
>
> Fixes: b1906cea00b0 ("wifi: mm81x: add mm81x Wi-Fi HaLow driver")
> Signed-off-by: Linmao Li <lilinmao@xxxxxxxxxx>

Reviewed-by: Dan Callaghan <dan.callaghan@xxxxxxxxxxxxxx>