From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795029596; b=yeEa14hb6ZUkLPl0VpWIX7ImKqfQncVMsLmt/Zr6fLR6+3TTID7sSwnsQAbGfiQ6SRz+ eOVaF/Xxmdbjq3+vL7p66TtAbGk6JGFBWr9ZoY688/yKKFGMY76wdbnf8tax/w0zbqwmL FkkJvDO7I3tPm/nd59u5f7v6WWnshU4Qdr36qExhO+e11V77QRb6beOP5IoeBkbVDqCoD CVm66wuN3C7iIy67Tv5q4KGOrRtMG8aqSebwzZwCJkCiEkUGCzhA/yBl6mdB5K/BcmtqW 6yPg9tPgfhDUNVljhmnIUDPZfG6oaHqRB/NFL4ZJmt7WL3gPzN9Lkh8xLpSmR3HdpTQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795029596; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=PjXNLi0y0JCQ5b0wapqfJLGNastuvnnsbXD2lJsqk38=; b=lN3KQJCtz6PvtR6kRPfYNlcWiKHHC4Jj6MSxM9ub5YkkkH+Swjr5eH0dPhbixvvHkBP+ hx7qpWytlOPNEo+Lp4btUCIFaW0VmIZzBVLqt/y5FXATRdlVTer7ZqnPJVBb8oHqzF4Xl /BVab8VhDSVsUQy+upInratUEQltN9scx+uLgOm34Swga+f4KY1s3AluODqaJsIQ0kvB8 OjUbfWtclcnH0MzRPXa8R79u1J00Ds0+1efb6cNWl5bmqJJcjrKrDz+INq2sywr7BDfTM XdLSG0/8BLIusqGVhJbDpeyaZgEvhzKWF1AYhDCpQuw8whZNMgDEeXT7R3PX77Jv2cg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=MLmNK6Fn; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB09F606A325; Wed, 18 Nov 2026 19:19:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=MLmNK6Fn Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73B681F000C4; Wed, 18 Nov 2026 19:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795029595; bh=PjXNLi0y0JCQ5b0wapqfJLGNastuvnnsbXD2lJsqk38=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MLmNK6FnHsdKnOhPmRXlxAMXEUzr6j+wGCNReF7P/ohvnrqLrpVErvPSh4KBE15b7 NYoww8oG/3zsibEei1RcQnW7Nuu7A0ls91GyL4mB5pO+GVSbtMGsIVhVPSRaBFixSd 3w0u2+lW1BgxuYcdNRBxOEfTubrmQFmHFtb9BNk8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= , Alexander Sverdlin , Johannes Berg , Sasha Levin Subject: [PATCH 6.12 0405/1756] wifi: wfx: fix use-after-free of the cooling work on device removal Date: Wed, 18 Nov 2026 15:42:12 +0100 Message-ID: <20261118150024.887963875@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150007.957976754@linuxfoundation.org> References: <20261118150007.957976754@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jérôme Pouiller [ Upstream commit 17402a869778f6c17b88fd360d7a96378779f97c ] When the device reports that it is too hot, wfx_suspend_hot_dev() blocks the Tx queues and arms cooling_timeout_work with a 10s delay. If the device recovers a normal temperature before the delay expires, the work is canceled. Else, the work declares the chip frozen and unblocks the Tx queues. However, this work is never canceled when the device is removed. cooling_timeout_work is queued on the system workqueue, while struct wfx_dev is released by wfx_free_common() (through ieee80211_free_hw()). So, if the device is unbound during this 10s window, the work fires after struct wfx_dev has been freed and dereferences it. Cancel the work during the teardown. It has to be done after wfx_bh_unregister(): the "device too hot" indication is processed by the bh, so canceling the work earlier would allow the bh to rearm it. On the other hand, the work calls wfx_tx_unlock(), which may in turn call wfx_bh_request_tx(). So it has to be canceled before bh_wq is destroyed. Note that the Tx queues are intentionally left blocked: the device is going away, so there is nothing to unblock. The issue was reported by the Sashiko review bot and the fix has been written by Copilot (including the commit log). The use-case is difficult to reproduce, so this code has not been tested. However, I don't believe this patch could cause any regression. Fixes: 1d52d29983e5d ("staging: wfx: add support for 'device too hot' indication") Assisted-by: Sashiko:gemini-3.1-pro-preview Assisted-by: Copilot:claude-opus-5 Signed-off-by: Jérôme Pouiller Tested-by: Alexander Sverdlin Reviewed-by: Alexander Sverdlin Link: https://patch.msgid.link/20260906204831.949692-2-jerome.pouiller@silabs.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/silabs/wfx/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/silabs/wfx/main.c b/drivers/net/wireless/silabs/wfx/main.c index fced10c057043..a2af18d790f13 100644 --- a/drivers/net/wireless/silabs/wfx/main.c +++ b/drivers/net/wireless/silabs/wfx/main.c @@ -473,6 +473,7 @@ int wfx_probe(struct wfx_dev *wdev) wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv); bh_unregister: wfx_bh_unregister(wdev); + cancel_delayed_work_sync(&wdev->cooling_timeout_work); destroy_workqueue(wdev->bh_wq); return err; } @@ -483,6 +484,7 @@ void wfx_release(struct wfx_dev *wdev) wfx_hif_shutdown(wdev); wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv); wfx_bh_unregister(wdev); + cancel_delayed_work_sync(&wdev->cooling_timeout_work); destroy_workqueue(wdev->bh_wq); } -- 2.53.0