From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 482513B38BC; Sat, 12 Sep 2026 18:39:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789238369; cv=none; b=riC1O6SW4Xpa2/Gxoolds9jwGneEEuoNskiSnJEWSogDS1hIb6+srcnWEyz7KDB2vAeWZLWTfI05VLVmAaEfzqRodUx3UCgowexhxWdftfC+8k5OiOU7buPEpkoGjiUrnJ7k9gO0Io29X2v+iujIzUdbJh9ey6pg23qLellbPaA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789238369; c=relaxed/simple; bh=pyXRb8fxp5r4FufVQ2LfGOS3w3uDVYQ/FVnEI4Khf1g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QSWJzUnkw/vHrCldm2hJ8bQqdXPnVmUfDSO++CHipapdcGQRCkiTn7c4QNqb0DInAyeL1zWGPIR3lxoUBcK9Cm3HfJhJCKQcSHsA37guM62PPIcw0/7tJmTCXVfOM0UZh8aXWVsbeZIZBKKEgLfuQfS0ID6XtKZZCtKROEXy4FM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pHS71qfk; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pHS71qfk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39C051F000FF; Sat, 12 Sep 2026 18:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789238364; bh=Fayvi6uwJQ4QpyENGjui9BiG4gT8JR2QIxIcLnsmUfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pHS71qfkXAuShXPFVt7P6/yXBdaObsdm9gqh0ijZ/g7/AApCn/VMWElUXv+r3vqkT 0q6zvS6KEW4YWHSC3UFWP7vw27R8c2eCX1A1hL1ehpJ/GiY0e5GTThwD5F0Pnto0RW uaI16G8l2hsIQSuj6XlsjCE/w62mqcIOq2hn5PAI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Runyu Xiao , Mark Brown , Sasha Levin Subject: [PATCH 5.15 404/935] ASoC: rt700-sdw: always drain jack work on remove Date: Sat, 12 Sep 2026 08:57:14 +0200 Message-ID: <20260912065536.090656152@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Runyu Xiao [ Upstream commit 612ccf42acd14bb2685fa60c3495ca13e63e8989 ] rt700_sdw_remove() drains jack_detect_work and jack_btn_check_work only when rt700->hw_init is true. That state bit is cleared by rt700_update_status() when the SoundWire slave becomes UNATTACHED, but a jack work item can already have been queued by rt700_interrupt_callback() or rt700_jack_init() while the device was initialized. Do not use hw_init as the remove-time guard for draining these work objects. The delayed works are initialized during rt700_init(), so remove can cancel them unconditionally and pair the object lifetime with the codec-private data lifetime instead of a mutable hardware state bit. This issue was found by our static analysis tool and then confirmed by manual review of the SoundWire status, interrupt and remove paths. The remove path should drain work based on whether the work object exists, not on a runtime hardware state bit that can change after the work was queued. A QEMU PoC queued jack_detect_work, simulated SDW_SLAVE_UNATTACHED, and then entered remove. DEBUG_OBJECTS reported an active timer/work object associated with the rt700 jack work path after remove skipped the cancel. This is sent as an RFC because the practical trigger depends on SoundWire core remove ordering after an UNATTACHED status update. If remove cannot run after hw_init has been cleared while jack work is still pending, this is a defensive lifecycle cleanup rather than a reachable race on current systems. Fixes: 737ee8bdf682 ("ASoC: rt700-sdw: use cancel_work_sync() in .remove as well as .suspend") Signed-off-by: Runyu Xiao Link: https://patch.msgid.link/20260619122325.2504287-1-runyu.xiao@seu.edu.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/rt700-sdw.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c index f7439e40ca8b5..b344c79532482 100644 --- a/sound/soc/codecs/rt700-sdw.c +++ b/sound/soc/codecs/rt700-sdw.c @@ -464,10 +464,8 @@ static int rt700_sdw_remove(struct sdw_slave *slave) { struct rt700_priv *rt700 = dev_get_drvdata(&slave->dev); - if (rt700->hw_init) { - cancel_delayed_work_sync(&rt700->jack_detect_work); - cancel_delayed_work_sync(&rt700->jack_btn_check_work); - } + cancel_delayed_work_sync(&rt700->jack_detect_work); + cancel_delayed_work_sync(&rt700->jack_btn_check_work); if (rt700->first_hw_init) pm_runtime_disable(&slave->dev); -- 2.53.0