From: sashiko-bot@kernel.org
To: "Neo Chang" <YLCHANG2@nuvoton.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3] ASoC: codecs: nau8360: Block DSP path selection when firmware load fails
Date: Tue, 08 Sep 2026 03:17:52 +0000 [thread overview]
Message-ID: <20260908031753.19E531F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260908030342.222655-1-YLCHANG2@nuvoton.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Medium] Returning 0 instead of a negative error code when rejecting a control write falsely signals success to userspace.
- [Medium] Un-ratelimited dev_warn in a userspace-triggerable put callback allows kernel log spam.
Pre-existing issues:
- [High] AB-BA deadlock between nau8360->lock and DAPM mutex during concurrent stream startup and mux update.
--
commit 54e06a9679644c8f5b17d3ad1a405ed38c16ac9a
Author: Neo Chang <YLCHANG2@nuvoton.com>
ASoC: codecs: nau8360: Block DSP path selection when firmware load fails
This commit blocks the DSP path selection in nau8360_dac_mux_put_enum()
if the firmware is not ready. It adds a check to reject the userspace
request and print a warning to prevent invalid routing states.
> diff --git a/sound/soc/codecs/nau8360.c b/sound/soc/codecs/nau8360.c
> index 89b8ee80d6c86..57a5023fe7b7c 100644
> --- a/sound/soc/codecs/nau8360.c
> +++ b/sound/soc/codecs/nau8360.c
> @@ -719,6 +719,11 @@ static int nau8360_dac_mux_put_enum(struct snd_kcontrol *kcontrol,
> return ret;
> }
>
> + if (item[0] == NAU8360_DAC_SRC_DSP && !nau8360->load_fw_done) {
> + dev_warn(nau8360->dev, "Cannot enable DSP: Firmware not ready or disabled\n");
[Severity: Medium]
Can this un-ratelimited warning lead to kernel log spam? If a userspace
application continuously attempts to set the DSP path while the firmware
is not loaded, it might flood dmesg and hide other system messages.
> + return ret;
[Severity: Medium]
Since ret is initialized to 0, does returning 0 here falsely signal success
to userspace?
The commit message mentions that returning 0 rejects the invalid request, but
it looks like when userspace attempts to set the DAC path to DSP before the
firmware is loaded, the application might cache the control state as DSP
while the hardware remains in HW1.
Should this return a negative error code like -EBUSY or -EINVAL instead to
properly reject the request?
> + }
> +
> mutex_lock(&nau8360->lock);
>
> ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
[Severity: High]
This is a pre-existing issue, but does this locking sequence create an AB-BA
deadlock?
In nau8360_dac_mux_put_enum(), nau8360->lock is acquired, and then
snd_soc_dapm_put_enum_double() takes the DAPM mutex:
nau8360_dac_mux_put_enum()
mutex_lock(&nau8360->lock);
snd_soc_dapm_put_enum_double()
snd_soc_dapm_mutex_lock(card);
However, if a stream startup occurs concurrently, dapm_power_widgets() will
hold the DAPM mutex and can trigger nau8360_dsp_clock_event() which acquires
nau8360->lock:
dapm_power_widgets()
snd_soc_dapm_mutex_lock(card);
...
nau8360_dsp_clock_event()
mutex_lock(&nau8360->lock);
Could an unprivileged user trigger both actions concurrently and deadlock
the audio subsystem?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260908030342.222655-1-YLCHANG2@nuvoton.com?part=1
next prev parent reply other threads:[~2026-09-08 3:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 3:03 [PATCH v3] ASoC: codecs: nau8360: Block DSP path selection when firmware load fails Neo Chang
2026-09-08 3:17 ` sashiko-bot [this message]
2026-09-08 13:31 ` Mark Brown
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=20260908031753.19E531F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=YLCHANG2@nuvoton.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--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 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.