From: sashiko-bot@kernel.org
To: "Srinivas Kandagatla" <srinivas.kandagatla@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 03/11] ASoC: SDCA: expose class SoundWire probe/remove/read_prop as library
Date: Mon, 07 Sep 2026 08:51:43 +0000 [thread overview]
Message-ID: <20260907085144.0F49D1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907083727.733705-4-srinivas.kandagatla@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
New issues:
- [Medium] sdca_class_probe() queues an async work item but does not tie its cancellation to devres, creating a potential use-after-free hazard for caller drivers on probe failure.
Pre-existing issues:
- [High] The PM runtime usage counter is permanently leaked if devm_pm_runtime_enable() fails during probe.
- [High] The PM runtime usage counter is permanently leaked if the deferred boot work is cancelled before execution.
- [High] The return value of sdw_slave_read_prop() is ignored, masking potential memory allocation failures and leaving properties uninitialized.
- [High] If the runtime force suspend fails during a system suspend transition, the device's interrupt is left permanently disabled.
--
commit 1cb538c9d508b4520bb99ff1157d3ff8f38843e9
Author: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
ASoC: SDCA: expose class SoundWire probe/remove/read_prop as library
Split the internal class_sdw_probe/class_sdw_remove/class_read_prop
functions into caller-friendly library helpers. The class_sdw_probe and
class_sdw_remove callbacks of the built-in class_sdw_driver are now thin
wrappers that defer to the exported helpers.
> diff --git a/sound/soc/sdca/sdca_class.c b/sound/soc/sdca/sdca_class.c
> index 88a29116a334e..b952fa6eb802f 100644
> --- a/sound/soc/sdca/sdca_class.c
> +++ b/sound/soc/sdca/sdca_class.c
[ ... ]
> @@ -24,7 +24,15 @@
>
> #define CLASS_SDW_ATTACH_TIMEOUT_MS 5000
>
> -static int class_read_prop(struct sdw_slave *sdw)
> +/**
> + * sdca_class_read_prop - fill SDCA-common SoundWire slave properties
> + * @sdw: SoundWire slave
> + *
> + * Exported so codec-specific SoundWire drivers can invoke the SDCA
> + * common property setup from their own sdw_slave_ops.read_prop, and
> + * then apply codec-specific overrides inline.
> + */
> +int sdca_class_read_prop(struct sdw_slave *sdw)
> {
> struct sdw_slave_prop *prop = &sdw->prop;
>
> @@ -36,9 +44,10 @@ static int class_read_prop(struct sdw_slave *sdw)
>
> return 0;
> }
> +EXPORT_SYMBOL_NS_GPL(sdca_class_read_prop, "SND_SOC_SDCA_CLASS");
[Severity: High]
This is a pre-existing issue, but is it safe to ignore the return value of
sdw_slave_read_prop() here?
If sdw_slave_read_prop() returns -ENOMEM upon memory exhaustion, ignoring it
might cause the SoundWire core to unknowingly operate on uninitialized
properties (e.g., null pointers for src_dpn_prop), leading to null pointer
dereferences during enumeration.
[ ... ]
> @@ -185,14 +205,47 @@ static int class_sdw_probe(struct sdw_slave *sdw, const struct sdw_device_id *id
>
> return 0;
> }
> +EXPORT_SYMBOL_NS_GPL(sdca_class_probe, "SND_SOC_SDCA_CLASS");
[Severity: Medium]
Does sdca_class_probe() create a use-after-free hazard for caller drivers on
probe failure?
If a caller allocates sdca_class_drv via devm, calls sdca_class_probe(), and
encounters an error before its own probe finishes, the async boot_work is left
queued:
queue_work(system_long_wq, &drv->boot_work);
return 0;
If the caller unwinds its devres allocations without manually cancelling the
work, the background class_boot_work() could dereference the freed drv pointer.
Should a devm action be added to guarantee the cancellation of boot_work?
[Severity: High]
This is a pre-existing issue, but does sdca_class_probe() leak the PM runtime
usage counter if devm_pm_runtime_enable() fails?
In sdca_class_probe(), pm_runtime_get_noresume(dev) increments the usage
counter. If devm_pm_runtime_enable(dev) fails immediately after, the function
returns directly without calling pm_runtime_put_noidle() to decrement the
usage counter:
pm_runtime_get_noresume(dev);
ret = devm_pm_runtime_enable(dev);
if (ret)
return ret;
Could this permanently prevent the device from entering runtime suspend?
>
> -static void class_sdw_remove(struct sdw_slave *sdw)
> +static int class_sdw_probe(struct sdw_slave *sdw, const struct sdw_device_id *id)
> +{
[ ... ]
+
+/**
+ * sdca_class_remove - SDCA class SoundWire slave remove helper
+ * @drv: caller-owned sdca_class_drv (the one handed to sdca_class_probe()).
+ *
+ * Cancels the deferred boot work so devres can safely free @drv and the
+ * embedding codec priv without racing class_boot_work. Codec-specific
+ * SoundWire drivers that call sdca_class_probe() must call this from
+ * their .remove with the same drv pointer they passed to probe.
+ */
+void sdca_class_remove(struct sdca_class_drv *drv)
+{
> cancel_work_sync(&drv->boot_work);
> }
> +EXPORT_SYMBOL_NS_GPL(sdca_class_remove, "SND_SOC_SDCA_CLASS");
[Severity: High]
This is a pre-existing issue, but does this leak the PM runtime usage counter
if the deferred boot work is cancelled before execution?
sdca_class_probe() increments the PM usage count via pm_runtime_get_noresume().
The decrement exclusively occurs inside the deferred class_boot_work(). If the
device is removed and cancel_work_sync() successfully prevents the work from
running, the return value of cancel_work_sync() is ignored and the decrement
never occurs.
> +
> +static void class_sdw_remove(struct sdw_slave *sdw)
> +{
> + struct sdca_class_drv *drv = dev_get_drvdata(&sdw->dev);
> +
> + sdca_class_remove(drv);
> +}
>
> /**
> * sdca_class_system_suspend - SDCA class system suspend helper
[Severity: High]
This is a pre-existing issue, but does sdca_class_system_suspend() leave the
device's interrupt permanently disabled if runtime force suspend fails?
In sdca_class_system_suspend():
disable_irq(drv->sdw->irq);
ret = pm_runtime_force_suspend(drv->dev);
if (ret) {
dev_err(drv->dev, "failed to force suspend: %d\n", ret);
return ret;
}
If pm_runtime_force_suspend() fails, the error is returned immediately and the
system suspend transition is aborted. However, enable_irq(drv->sdw->irq) is not
called in this error path, which might render the device unresponsive to
interrupts.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260907083727.733705-1-srinivas.kandagatla@oss.qualcomm.com?part=3
next prev parent reply other threads:[~2026-09-07 8:51 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 8:37 [PATCH v2 00/11] ASoC: SDCA: enable on DT platforms and add Qualcomm WCD9378 (Tambora) codec Srinivas Kandagatla
2026-09-07 8:37 ` [PATCH v2 01/11] ASoC: SDCA: allow building without ACPI Srinivas Kandagatla
2026-09-07 8:54 ` Richard Fitzgerald
2026-09-07 9:09 ` Takashi Iwai
2026-09-07 8:37 ` [PATCH v2 02/11] ASoC: SDCA: export PM helpers keyed on sdca_class_drv Srinivas Kandagatla
2026-09-07 8:50 ` sashiko-bot
2026-09-07 9:43 ` Srinivas Kandagatla
2026-09-08 16:22 ` Charles Keepax
2026-09-08 17:49 ` Srinivas Kandagatla
2026-09-07 8:37 ` [PATCH v2 03/11] ASoC: SDCA: expose class SoundWire probe/remove/read_prop as library Srinivas Kandagatla
2026-09-07 8:51 ` sashiko-bot [this message]
2026-09-07 11:31 ` Pierre-Louis Bossart
2026-09-07 13:29 ` Srinivas Kandagatla
2026-09-07 8:37 ` [PATCH v2 04/11] ASoC: SDCA: add hw_ops with hw_init hook Srinivas Kandagatla
2026-09-07 11:29 ` Pierre-Louis Bossart
2026-09-07 13:33 ` Srinivas Kandagatla
2026-09-07 8:37 ` [PATCH v2 05/11] ASoC: SDCA: add populate_function hw_op for DT function data Srinivas Kandagatla
2026-09-07 11:28 ` Pierre-Louis Bossart
2026-09-07 13:16 ` Charles Keepax
2026-09-08 16:25 ` Charles Keepax
2026-09-08 18:00 ` Srinivas Kandagatla
2026-09-09 8:34 ` Charles Keepax
2026-09-07 8:37 ` [PATCH v2 06/11] ASoC: SDCA: class_function: xlate sound-dai cell by entity index Srinivas Kandagatla
2026-09-07 8:37 ` [PATCH v2 07/11] ASoC: SDCA: register SDCA_FUNCTION_TYPE_SIMPLE_JACK in class function driver Srinivas Kandagatla
2026-09-07 11:32 ` Pierre-Louis Bossart
2026-09-07 8:37 ` [PATCH v2 08/11] ASoC: SDCA: make find_sdca_control_reset() return void Srinivas Kandagatla
2026-09-07 11:32 ` Pierre-Louis Bossart
2026-09-07 13:03 ` Charles Keepax
2026-09-07 13:16 ` Srinivas Kandagatla
2026-09-07 8:37 ` [PATCH v2 09/11] ASoC: SDCA: add sdca_apply_default_control_classifiers() helper Srinivas Kandagatla
2026-09-07 8:37 ` [PATCH v2 10/11] dt-bindings: sound: qcom: add Tambora WCD9378 SDCA codec Srinivas Kandagatla
2026-09-07 8:56 ` sashiko-bot
2026-09-07 8:37 ` [PATCH v2 11/11] ASoC: codecs: add Qualcomm Tambora (WCD9378) " Srinivas Kandagatla
2026-09-07 9:01 ` sashiko-bot
2026-09-07 11:32 ` Pierre-Louis Bossart
2026-09-07 13:03 ` Srinivas Kandagatla
2026-09-07 19:47 ` Pierre-Louis Bossart
2026-09-07 21:26 ` Mark Brown
2026-09-07 22:37 ` Srinivas Kandagatla
2026-09-08 8:49 ` Charles Keepax
2026-09-08 9:09 ` Srinivas Kandagatla
2026-09-08 10:37 ` Richard Fitzgerald
2026-09-08 12:31 ` Srinivas Kandagatla
2026-09-08 13:20 ` Charles Keepax
2026-09-08 13:34 ` Srinivas Kandagatla
2026-09-08 14:22 ` Pierre-Louis Bossart
2026-09-08 15:33 ` Charles Keepax
2026-09-08 15:34 ` Srinivas Kandagatla
2026-09-08 15:58 ` Uwe Kleine-König
2026-09-08 16:20 ` Charles Keepax
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=20260907085144.0F49D1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=srinivas.kandagatla@oss.qualcomm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.