From: sashiko-bot@kernel.org
To: "Neil Armstrong" <neil.armstrong@linaro.org>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 19/19] ASoC: qcom: sc8280xp: allow using the sc8280xp card with lpass-cpu
Date: Tue, 24 Nov 2026 17:56:55 +0000 [thread overview]
Message-ID: <sashiko-outbox-231759@kernel.org> (raw)
In-Reply-To: <20261124-topic-sm8650-el2-v2-19-174e159f0f69@linaro.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ASoC: qcom: sc8280xp: missing jack cleanup and link exit on
DSP Bypass links
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [High] ASoC: qcom: sc8280xp: missing WCD jack cleanup in
sc8280xp_snd_exit() [1]
--
commit 30357a271c5bc6a19f163b41e5ab561af21084a8
Author: Neil Armstrong <neil.armstrong@linaro.org>
ASoC: qcom: sc8280xp: allow using the sc8280xp card with lpass-cpu
This commit adds init and ops callbacks for DSP Bypass DAI links in the
sc8280xp machine driver and attaches the WCD jack to LPASS CPU TX codec DMA
DAIs in qcom_snd_wcd_jack_setup().
> diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
> index ac4dfb2c2182c..4fcccf7ec4965 100644
> --- a/sound/soc/qcom/sc8280xp.c
> +++ b/sound/soc/qcom/sc8280xp.c
[ ... ]
> @@ -377,6 +378,37 @@ static int nord_snd_init(struct snd_soc_pcm_runtime *rtd)
> return 0;
> }
>
> +static int sc8280xp_lpass_snd_init(struct snd_soc_pcm_runtime *rtd)
> +{
> + struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
> + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> + struct snd_soc_card *card = rtd->card;
> +
> + switch (cpu_dai->id) {
> + case LPASS_CDC_DMA_WSA_RX0:
> + case LPASS_CDC_DMA_WSA_RX1:
> + /*
> + * Set limit of -3 dB on Digital Volume and 0 dB on PA Volume
> + * to reduce the risk of speaker damage until we have active
> + * speaker protection in place.
> + */
> + snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 81);
> + snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 81);
> + snd_soc_limit_volume(card, "SpkrLeft PA Volume", 17);
> + snd_soc_limit_volume(card, "SpkrRight PA Volume", 17);
> + break;
> + case LPASS_DP_RX:
> + return qcom_snd_dp_jack_setup(rtd, &data->dp_jack[0], 0);
> + default:
> + break;
> + }
> +
> + if (data->priv->wcd_jack)
> + return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
> +
> + return 0;
> +}
[Severity: High]
This problem wasn't introduced by this patch, but sc8280xp_snd_exit() skips
headset jack cleanup for WCD jack configurations [1].
Both sc8280xp_snd_init() and sc8280xp_lpass_snd_init() initialize data->jack
and set data->jack_setup = true for WCD jack configurations, whereas
sc8280xp_snd_exit() only calls qcom_snd_headset_jack_cleanup() and clears
data->jack_setup when dai_data->jack_setup is SC8280XP_JACK_SETUP_CODEC:
sound/soc/qcom/sc8280xp.c:sc8280xp_snd_exit() {
...
dai_data = sc8280xp_get_dai_data(data->priv, cpu_dai->id);
if (dai_data && dai_data->jack_setup == SC8280XP_JACK_SETUP_CODEC) {
qcom_snd_headset_jack_cleanup(rtd);
data->jack_setup = false;
}
}
When a card with a WCD jack unbinds, snd_card_free() frees data->jack.jack
while codec components retain &data->jack and data->jack_setup remains true.
On rebind, qcom_snd_headset_jack_init() skips creating a new jack and
re-registers the dangling data->jack with the codec components, causing a
use-after-free on the next headset jack event.
[ ... ]
> @@ -549,6 +633,10 @@ static void sc8280xp_add_be_ops(struct snd_soc_card *card)
> link->exit = sc8280xp_snd_exit;
> link->be_hw_params_fixup = sc8280xp_be_hw_params_fixup;
> link->ops = &sc8280xp_be_ops;
> + } else if (!link->dynamic) {
> + /* DSP Bypass link, neither a DPCM frontend nor a backend */
> + link->init = sc8280xp_lpass_snd_init;
> + link->ops = &sc8280xp_lpass_ops;
> }
> }
> }
[Severity: Medium]
Should DSP Bypass links also wire a link->exit callback to call
qcom_snd_headset_jack_cleanup() and reset data->jack_setup = false?
Without an exit callback to pair with sc8280xp_lpass_snd_init(), unbinding and
rebinding a component on a DSP Bypass card with data->priv->wcd_jack set leaves
data->jack_setup true after snd_card_free() frees data->jack.jack, leading to
a use-after-free in snd_soc_jack_report() when a jack event is reported.
[1] https://sashiko.dev/#/bug/linux-70cecd60-74fd-40f1-95c8-8dc260e646ac
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-topic-sm8650-el2-v2-0-174e159f0f69@linaro.org?part=19
prev parent reply other threads:[~2026-11-24 17:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 17:32 [PATCH v2 00/19] arm64: qcom: enable SM8650 audio without ADSP firmware Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 01/19] ASoC: qcom: lpass-cpu: fix RXTX WRDMA current address register readability Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 02/19] ASoC: qcom: lpass-platform: disable the RXTX & VA DMA interrupts on stop Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 03/19] ASoC: dt-bindings: qcom,lpass: add Senary & Septenary MI2S ids Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 04/19] ASoC: dt-bindings: qcom,lpass: add WSA RX and TX channels ids Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 05/19] ASoC: dt-bindings: qcom,lpass-*-macro: document less clock when ADSP is not used Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 06/19] ASoC: dt-bindings: qcom,lpass-cpu: document the SM8650 LPASS Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 07/19] ASoC: codecs: lpass-wsa-macro: handle the macro & dcodec power domains Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 08/19] ASoC: qcom: lpass-cpu: get the optional codec_mem3 clock Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 09/19] ASoC: qcom: lpass: add support for optional WSA interface Neil Armstrong
2026-11-24 17:54 ` sashiko-bot
2026-11-24 17:32 ` [PATCH v2 10/19] ASoC: qcom: lpass-cdc-dma: add support for WSA codec DMA Neil Armstrong
2026-11-24 17:44 ` sashiko-bot
2026-11-24 17:32 ` [PATCH v2 11/19] ASoC: qcom: lpass: prepare to handle multiple lpaifs for i2s Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 12/19] ASoC: qcom: lpass: add support for MI2S_SENARY & MI2S_SEPTENARY Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 13/19] ASoC: qcom: lpass: support mapping I2S ports to multiple LPAIFs Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 14/19] ASoC: qcom: lpass: support LPM memory type for I2S LPAIFs Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 15/19] ASoC: qcom: lpass: allocate LPM buffer memory to DAIs Neil Armstrong
2026-11-24 18:01 ` sashiko-bot
2026-11-24 17:32 ` [PATCH v2 16/19] ASoC: qcom: lpass: enable the right codec_mem clock when usin LPM memory Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 17/19] ASoC: qcom: add SM8650 LPASS CPU driver Neil Armstrong
2026-11-24 17:32 ` [PATCH v2 18/19] ASoC: qcom: sdw: allow LPASS_CDC_DMA_WSA_RX0 as soundwire dai Neil Armstrong
2026-11-24 17:48 ` sashiko-bot
2026-11-24 17:32 ` [PATCH v2 19/19] ASoC: qcom: sc8280xp: allow using the sc8280xp card with lpass-cpu Neil Armstrong
2026-11-24 17:56 ` 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-231759@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=neil.armstrong@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox