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=1796385197; b=A3yl3cmZuHjreWhBDu/u3CmJZsw05aTXggtK+qjlMuCtGrkRzKWOYkLnKMEf0I65Q+hq XRKQXr9xzF74Psbu46fnjz9heumbnPmSo7BqmN5bF38qcFBHONR9jBr9P+tR5KhdzP4d3 TMi4n2Zt+0bYH7ARPZi97rlnVtgsuNL/XPMmi1sUgZAC3GiTt9gKLDJ7o+5DQ2XE7B97W VoLqgu8AKAt0U+TORt2zpwxfIZXVV20cDnxgCdXFic3F6LSdnUIK4IeNUqn71/8p8rhSS PsJ/qXxZO2L/yg8s1DELd4YjvRB5XEG5I1cuAdluYoe79G7kAgcGZv4X0lAtZ+dzU/Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385197; 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-Transfer-Encoding; bh=Bk8gTPc5oAxVtCF5gtwwMI0w2VrWNDimmIsC58ViDMs=; b=ExKRwfHj8TP9aD0w184GH4b3wl50hFkGdyTuH5Kn3BUc+S/PWODBniMv93IFcGpNvGRj ak7jjtaZ+gEUG475LE81qpFXR67Vyy71iDzYvYlayz+//eM5lQgyr+n3KFocn1Ammr5nr +hLFQELraUgwp/oDDxf48D69HzuBt0rR2zKBW5rMF9EH7WCurbSOd7MXlr2T2m4HvzOEG rduEyTK6n6gG9Q9dtEjlYjEi2OvT31svdpYYJ65G/WGzSseOJ13WPNSC9qxhJdrshC2Ny oEDDzYQrO2Gc/vLKAbBrpCM2M6SPMyz2im7VAnXS0UGZ+7W7osb8YK+uWWpVqPkd7oA== 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=UZrRkAGO; 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 2E617606A322; Fri, 4 Dec 2026 11:53:17 +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=UZrRkAGO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C6441F000C2; Fri, 4 Dec 2026 11:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385197; bh=Bk8gTPc5oAxVtCF5gtwwMI0w2VrWNDimmIsC58ViDMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UZrRkAGOYe/wdOLSJU3Y53cyOSua2R708gUWmu/zBBlRVRgShy6fOw/W3VaQZZdz6 dPo9p9hVpzM6GQ8uHoCb4V/+S1U4s03Ef5vy2E0S2PHNwDQl/5r5hgIaK/rMtF+Gka jcT/gsRxUk7s2Nq128Dc6jlcRWx0DBX2ql+KfxSY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ijae Kim , Myeonghun Pak , Mark Brown , Sasha Levin Subject: [PATCH 6.6 0418/1167] ASoC: rt5645: Shut down the button timer on removal Date: Fri, 4 Dec 2026 18:57:25 +0900 Message-ID: <20261204100712.910351066@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Myeonghun Pak [ Upstream commit f0ecc305442f20a6df2575943e9897825d80cc5d ] jack_detect_work can rearm btn_check_timer, and the timer callback can queue jack_detect_work. Deleting the timer before cancelling the work does not break this cycle: an already running worker can rearm the timer after timer_delete_sync() returns. The timer can then outlive removal. Use timer_shutdown_sync() before cancelling the delayed work so that subsequent attempts to rearm the timer are ignored. The IRQ producer has already been removed at this point. Keep the restartable timer deletion in the suspend path. This issue was identified as part of our ongoing research while reviewing kernel code. Fixes: 7ff6319e7da5 ("ASoC: rt5645: use polling to support HS button") Assisted-by: LLM Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak Link: https://patch.msgid.link/179203261324.2681924.5002100194676410503.rt5645-button-timer@gmail.com Signed-off-by: Mark Brown [ sashal: Replaced timer_delete_sync() with the older del_timer_sync() in the context, while the changed line itself still calls timer_shutdown_sync() as upstream does. ] Signed-off-by: Sasha Levin --- sound/soc/codecs/rt5645.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 4b35f6284d8c3..6b2250c89903d 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -4220,10 +4221,10 @@ static void rt5645_i2c_remove(struct i2c_client *i2c) free_irq(i2c->irq, rt5645); /* - * Since the rt5645_btn_check_callback() can queue jack_detect_work, - * the timer need to be delted first + * The timer and jack_detect_work can rearm each other. Shut down the + * timer before cancelling the work. */ - del_timer_sync(&rt5645->btn_check_timer); + timer_shutdown_sync(&rt5645->btn_check_timer); cancel_delayed_work_sync(&rt5645->jack_detect_work); cancel_delayed_work_sync(&rt5645->rcclock_work); -- 2.53.0