From: sashiko-bot@kernel.org
To: "Jiawen Liu" <liu1298662399@gmail.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH] soundwire: qcom: handle interface clock failure on runtime resume
Date: Sun, 29 Nov 2026 19:43:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-239980@kernel.org> (raw)
In-Reply-To: <179598033513.2.3324784559138164822.pattern-ext-053.3@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] soundwire: qcom: pm_runtime_disable() called after
sdw_bus_master_delete()
--
commit 0bb49a0cfd730102126279a4ada1a6ea8640b778
Author: Jiawen Liu <liu1298662399@gmail.com>
soundwire: qcom: handle interface clock failure on runtime resume
This commit checks the return value of clk_prepare_enable() in
swrm_runtime_resume() and updates qcom_swrm_remove() to disable runtime PM
and only disable the interface clock if the device is not runtime
suspended.
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index a4cb62897192e..0274957d1e48a 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -1787,7 +1787,9 @@ static void qcom_swrm_remove(struct platform_device *pdev)
> struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(&pdev->dev);
>
> sdw_bus_master_delete(&ctrl->bus);
> - clk_disable_unprepare(ctrl->hclk);
> + pm_runtime_disable(ctrl->dev);
> + if (!pm_runtime_status_suspended(ctrl->dev))
> + clk_disable_unprepare(ctrl->hclk);
> }
[Severity: Medium]
Should pm_runtime_disable(ctrl->dev) be called before
sdw_bus_master_delete(&ctrl->bus)?
__device_release_driver() drops its runtime PM reference via
pm_runtime_put_sync() before calling qcom_swrm_remove(), so ctrl->dev
enters remove with usage_count == 0 and runtime PM still enabled. While
sdw_bus_master_delete() unregisters active child slaves,
pm_runtime_reinit() decrements ctrl->dev->power.child_count and queues an
async runtime suspend on ctrl->dev (or the autosuspend timer can fire):
CPU0 CPU1 (pm_wq)
qcom_swrm_remove()
sdw_bus_master_delete(&ctrl->bus)
device_for_each_child(...,
sdw_delete_slave)
device_unregister(&slave->dev)
...
pm_request_idle(ctrl->dev)
swrm_runtime_suspend()
sdw_bus_prep_clk_stop(&ctrl->bus)
list_for_each_entry(slave,
&bus->slaves, node)
list_del_init(&slave->node)
put_device(&slave->dev) <-- list corruption / UAF
pm_runtime_disable(ctrl->dev)
Calling pm_runtime_disable(ctrl->dev) before sdw_bus_master_delete()
matches the reverse of qcom_swrm_probe() and waits for any in-flight
runtime PM transitions before tearing down the bus.
--
Sashiko AI review · https://sashiko.dev/#/patchset/179598033513.2.3324784559138164822.pattern-ext-053.3@gmail.com?part=1
prev parent reply other threads:[~2026-11-29 19:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 19:25 [PATCH] soundwire: qcom: handle interface clock failure on runtime resume Jiawen Liu
2026-11-29 19:43 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-239980@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=liu1298662399@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox