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 356124014BF for ; Thu, 30 Apr 2026 18:57:57 +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=1777575478; cv=none; b=sZ24NiNF6+aDnMkRVhhBlCxJ4zxnAf3AyyBVrPRrcCBm/Dn54LtE5BjNO/1OZNTjNLh2xb3IdwwS2iXACIjpAM9FL/NT6KtYXD6MK5OVaIoTg1KX+TEquWS2V4//gXh29mhGoZsSOM6q4pMwRCFr87OWj6OX2Y+cKdYMxE9CGTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777575478; c=relaxed/simple; bh=df854Rk1TprR94CjXbFYh2wpjIJg7TSylsZTM+LSqMM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wl/WIGzjQW0EGeTZ6Ek1JoxhzAWMp6OGnqcoBf2DY/EFZWn7ySR+1+CftyCcuvYrGhm6uDMb8uoJNVxOo8CNiQJSAY4F2G2msLDxZdvx36x9fRDGaBPY1gsCjTPy35G1lD6JRi+tUgWNdxcdK4M5O3fUVMpZXGraK1B4XUI3/xo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gGBYUDNy; 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="gGBYUDNy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5655DC2BCB3; Thu, 30 Apr 2026 18:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777575477; bh=df854Rk1TprR94CjXbFYh2wpjIJg7TSylsZTM+LSqMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gGBYUDNy1eDudJZb6tdTUW9XPv+UArTHwGtF2AUCCId8JQm/tnmFlrj9pJC0oK1MA l4p3aD0Z7mPlDxB3TqJgmKuh4j6TK8cP1IKi4w7xuVO6poJIXtRe1YE79ej/+01Mff q0D3SS+2y/NK3NZd5VCoOHsDhvoWf6aqivJy97YTyHHMAcOWwzdQuj+X2mscKA17fb vd3uugpVNmkzFBClETL6MjXEm8mf9okqM7NFRKrii+rCWdVtovMz9hy52rvc4jYBQA E7pXLo+V/xju+RXawbqJkJor8uRLNyrz4xrbjQGewrVgqYZRpRP3fh/xfUo3oufDYP wAmGHodywDZ2A== From: Sasha Levin To: stable@vger.kernel.org Cc: Daniel Hodges , Johannes Berg , Sasha Levin Subject: [PATCH 5.15.y] wifi: mwifiex: fix use-after-free in mwifiex_adapter_cleanup() Date: Thu, 30 Apr 2026 14:57:55 -0400 Message-ID: <20260430185755.1955735-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026043028-acorn-vagueness-1ac9@gregkh> References: <2026043028-acorn-vagueness-1ac9@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