From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4583134DB6C for ; Thu, 30 Apr 2026 19:47:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777578420; cv=none; b=C+R39k5TNf8x3T1wji1/6qwSlhFfcx6cX3OZh4rHc+YVbqWOZGGCnvxUTjegRV1L1gVgYW0cCD774vVR2FBcmzYoOV1ZlT42RMROibxn9gdzr4mRJzqUaAcC5w4X05TY15Ir10G+fNinWUp0hWOiG/DaY62S8HZsQhBzaF7jNxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777578420; c=relaxed/simple; bh=df854Rk1TprR94CjXbFYh2wpjIJg7TSylsZTM+LSqMM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a2BzV3f+nku0NVx1br5F0/xqIVs2uolQm671H17tOfHmn2WaOxmiv8JMhjwhwpFvBzIKNETvVpjViW41AOOMdOv7mYKoU1dJ04I/B7G1e9DRliGSBIK76s6cUgF5P6sD6QlR2X9zzNDZzR6358QRJXuD5al1E8Soxe3We5mVPaQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BBVCwdTk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BBVCwdTk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D458C2BCB3; Thu, 30 Apr 2026 19:46:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777578420; bh=df854Rk1TprR94CjXbFYh2wpjIJg7TSylsZTM+LSqMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BBVCwdTknDFe5LxcSPRLEiD6mhKxYmYqNTek0XDWe/zqSbELVoDlFbLOzMbOqMTNg KzRKVdxSFF62FbEQ+iD/0AWUbMshwhGbjckGD5mFro/yfypXoLPz7jBKgqG/TZDSK/ pEDvkgEHHxTDLI+pN7IEW/rCt3DPO3WMR6qiTQpZSAss2ARTON0+tUG08YfB6McOww 9ibukVRMmLZzrULJUcaG0P0M23xhkQFFutTJW4t84BwBTvWP+5c7oRXVp4zyqBmjWQ Iqsf8XgyWXF/oS9FBqkuU1QA23HBS0YkkZGCiZS577aiDnRveU7wws42U7hw9nr4st osPuRWEntw9ZQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Daniel Hodges , Johannes Berg , Sasha Levin Subject: [PATCH 5.10.y] wifi: mwifiex: fix use-after-free in mwifiex_adapter_cleanup() Date: Thu, 30 Apr 2026 15:46:57 -0400 Message-ID: <20260430194657.1996779-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026043028-icky-undrilled-1ab3@gregkh> References: <2026043028-icky-undrilled-1ab3@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Daniel Hodges [ Upstream commit ae5e95d4157481693be2317e3ffcd84e36010cbb ] 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: 4636187da60b ("mwifiex: add wakeup timer based recovery mechanism") Cc: stable@vger.kernel.org Signed-off-by: Daniel Hodges Link: https://patch.msgid.link/20260206194401.2346-1-git@danielhodges.dev Signed-off-by: Johannes Berg [ changed `timer_delete_sync(&adapter->wakeup_timer)` to `del_timer_sync(&adapter->wakeup_timer)` ] Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/mwifiex/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index f006a3d72b404..6ba7082d65b64 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -399,7 +399,7 @@ static void mwifiex_invalidate_lists(struct mwifiex_adapter *adapter) static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) { - del_timer(&adapter->wakeup_timer); + del_timer_sync(&adapter->wakeup_timer); del_timer_sync(&adapter->devdump_timer); mwifiex_cancel_all_pending_cmd(adapter); wake_up_interruptible(&adapter->cmd_wait_q.wait); -- 2.53.0