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 E136A3FF889 for ; Thu, 30 Apr 2026 16:31:58 +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=1777566719; cv=none; b=tweiRn0Gth1DDhgqSOUtsyGFaeWQk+3UBDGrfAWVLkC655CinT5tf+s5BBIVdB1KBrqvvE6rrBA5jRswNfNGZPk6rhrc+s5DYpr3tObEv+5+MLpV+8fvekEAQ0VnHc29cOm2/V+MLb6XZo+t8LW2RM4dUCan6gzDHE7qiesyIv4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777566719; c=relaxed/simple; bh=Rc04gXUKMcu7XC1waqA09bCbqBAg+aeYH1BWOhBm7dM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ufogTYWPJuxOkESfH7RxioaTvfdk6pEjOXYp0+u9EUK7cnBx53IFJQ3DohohMAqbER7isgJlqVS2utEaSbeKn4Uw8FwAaWSSZUkHbvhbmbRhysw5OE5ENLdiiD1VRzh7qZPX8VfSoCCO4dWcUkz/FTEQOIuQlEbccfi+nPdWVZg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N+dPgLHj; 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="N+dPgLHj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D3CDC2BCB3; Thu, 30 Apr 2026 16:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777566718; bh=Rc04gXUKMcu7XC1waqA09bCbqBAg+aeYH1BWOhBm7dM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+dPgLHjFiU/XdHU13tZuY+cMzkg1lt72tX+skSEYKVAF8ltVkkQJ3XrQ0JPriC5F 4K5CO4uzKqbPIm8+S2LiXb8Mu2+56tbOilSqmfxen865xTrNOaPulu7tK/x34zNkui 4+nFZe5x6XBGQ8gApIiJ75y4ieoqEQsUh0LB6wCjalZXt4VOiQOCDB9vtwC8lSogWp y6QjSvbPGx+kDcCa+t9RhYRPzDJrpRv2JcX1AvmSM995j2FmPZ8hev987PD0JX6Rge Pt+hbxbBySccP+zdBN4SQJa+4m/X7N4bhHz4x1t9hniG2G4alEvL5XKzsayyuMKAfr JCivpE0UtJyPQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Daniel Hodges , Johannes Berg , Sasha Levin Subject: [PATCH 6.12.y] wifi: mwifiex: fix use-after-free in mwifiex_adapter_cleanup() Date: Thu, 30 Apr 2026 12:31:55 -0400 Message-ID: <20260430163155.1837709-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026043026-graveyard-rinse-022f@gregkh> References: <2026043026-graveyard-rinse-022f@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()` to `del_timer_sync()` ] 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 8b61e45cd6678..4caf54954894d 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -390,7 +390,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); cancel_delayed_work_sync(&adapter->devdump_work); mwifiex_cancel_all_pending_cmd(adapter); wake_up_interruptible(&adapter->cmd_wait_q.wait); -- 2.53.0