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 E7011213E89 for ; Thu, 30 Apr 2026 17:56:45 +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=1777571806; cv=none; b=nYxda+8YRbkFVOt3R7BVNmDN3wDJGqpX/orhamcI/hTB8KYt8JAKKR9+pvgsDT27GFW+sNORzBjRH1nzFsOU2UPJEzxW9lx0eXli4XyZhBpTHndEqAoJAadawydDvBAqUUQcUnZ9TNMLzTFvcEzO55T81gihcLUEb9/5IkNBADA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777571806; c=relaxed/simple; bh=hOYlZT29qQaBLJVdhVdMEpLllGjVluIFmC/hqWsGsko=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qFDrrIt3KCja1aJiwGlCjS0FV/xXoLTgXIYte5nyqzyGn1+1IvdePMfwRT0YGl3alOU5x2FskcVMsE/SK8bSujs+72K9vdNEHHvZ1GdScvR5XybjFvf80XFmdEOud4QNXg7HWul0fQGhCuRaO9XwcEWuCXfXXlJhLDasGI9MSiY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GcpVTx/k; 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="GcpVTx/k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 370AAC2BCB8; Thu, 30 Apr 2026 17:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777571805; bh=hOYlZT29qQaBLJVdhVdMEpLllGjVluIFmC/hqWsGsko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GcpVTx/kJytsYMnc1bZ2coQIKNuGjXc1RIRp+lXY98DSNmNvpjMWZIHMDZU61G7RN L3tkO2XHkm3nT8Yx9f1x0NQQN9xoUjyHenTKJydGBjy4g9Xm6Q5q2cDat9vTxMtVOh kkK/Fb0xuzqU5R7R43oB503ev7Kym+A0PjrIkiW+vB7IyABl7eawBFrCcHHYZHA3HC E2k9KdU2cdQ/t4zSG+HkkmZ7mLv4iY7SFP+9mBGMHGxGh4mS3fLl6v1EXWfiaxOyjJ GDx9A0UcLHFTtphK3ms/Hk/2ORLkqruPyLY9im9tTjsSAUAlRaUbAhylOBn5GYHBp2 aaluI9u8pc+xQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Daniel Hodges , Johannes Berg , Sasha Levin Subject: [PATCH 6.1.y] wifi: mwifiex: fix use-after-free in mwifiex_adapter_cleanup() Date: Thu, 30 Apr 2026 13:56:43 -0400 Message-ID: <20260430175643.1905462-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026043027-lurch-equivocal-ad0b@gregkh> References: <2026043027-lurch-equivocal-ad0b@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 7dddb4b5dea1d..7ebacf600890f 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -388,7 +388,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