Skip to content

Commit 11869ce

Browse files
hodgesdsgregkh
authored andcommitted
wifi: mwifiex: fix use-after-free in mwifiex_adapter_cleanup()
[ Upstream commit ae5e95d ] The mwifiex_adapter_cleanup() function uses timer_delete() (non-synchronous) for the wakeup_timer before the adapter structure is freed. This is incorrect because timer_delete() does not wait for any running timer callback to complete. If the wakeup_timer callback (wakeup_timer_fn) is executing when mwifiex_adapter_cleanup() is called, the callback will continue to access adapter fields (adapter->hw_status, adapter->if_ops.card_reset, etc.) which may be freed by mwifiex_free_adapter() called later in the mwifiex_remove_card() path. Use timer_delete_sync() instead to ensure any running timer callback has completed before returning. Fixes: 4636187 ("mwifiex: add wakeup timer based recovery mechanism") Cc: stable@vger.kernel.org Signed-off-by: Daniel Hodges <git@danielhodges.dev> Link: https://patch.msgid.link/20260206194401.2346-1-git@danielhodges.dev Signed-off-by: Johannes Berg <johannes.berg@intel.com> [ changed `timer_delete_sync()` to `del_timer_sync()` ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7edd983 commit 11869ce

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/net/wireless/marvell/mwifiex

drivers/net/wireless/marvell/mwifiex/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ static void mwifiex_invalidate_lists(struct mwifiex_adapter *adapter)
386386
static void
387387
mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter)
388388
{
389-
del_timer(&adapter->wakeup_timer);
389+
del_timer_sync(&adapter->wakeup_timer);
390390
cancel_delayed_work_sync(&adapter->devdump_work);
391391
mwifiex_cancel_all_pending_cmd(adapter);
392392
wake_up_interruptible(&adapter->cmd_wait_q.wait);

0 commit comments

Comments
 (0)