All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tyler Baker" <tyler.baker@oss.qualcomm.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 2/2] ASoC: qcom: x1e80100: recreate the headset jack on card rebind
Date: Fri, 06 Nov 2026 06:01:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-200876@kernel.org> (raw)
In-Reply-To: <20261106054333.2748248-3-tyler.baker@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ASoC: qcom: x1e80100: missing DP jack cleanup in
  x1e80100_snd_exit()
--

commit f605374e23a64b3505524d6591f1d001a229a2a3
Author: Tyler Baker <tyler.baker@oss.qualcomm.com>

ASoC: qcom: x1e80100: recreate the headset jack on card rebind

This commit adds a DAI link exit callback for x1e80100 to clean up the
headset jack and reset jack_setup on card unbind.

> diff --git a/sound/soc/qcom/x1e80100.c b/sound/soc/qcom/x1e80100.c
> index c81df41ace883..213d7f45198cb 100644
> --- a/sound/soc/qcom/x1e80100.c
> +++ b/sound/soc/qcom/x1e80100.c
> @@ -68,6 +68,23 @@ static int x1e80100_snd_init(struct snd_soc_pcm_runtime *rtd)
>  	return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
>  }
>  
> +static void x1e80100_snd_exit(struct snd_soc_pcm_runtime *rtd)
> +{
> +	struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
> +	struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> +
> +	switch (cpu_dai->id) {
> +	case DISPLAY_PORT_RX_0:
> +	case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
> +		return;
> +	default:
> +		break;
> +	}

[Severity: High]
Does returning early for DisplayPort links leave hdmi_codec_priv->jack
pointing to data->dp_jack[dp_pcm_id] after snd_card_free() frees its
underlying struct snd_jack?

On card rebind, snd_soc_bind_card() runs soc_probe_link_components()
before soc_init_pcm_runtime() calls x1e80100_snd_init() to recreate
dp_jack->jack.  During soc_probe_link_components(), hdmi_probe() calls
drm_connector_hdmi_audio_hook_plugged_cb(), which synchronously invokes
hdmi_codec_jack_report():

sound/soc/codecs/hdmi-codec.c:hdmi_codec_jack_report() {
    ...
	if (jack_status != hcp->jack_status) {
		if (hcp->jack)
			snd_soc_jack_report(hcp->jack, jack_status, SND_JACK_AVOUT);
		hcp->jack_status = jack_status;
	}
}

If the DisplayPort plug state changed while the card was unbound,
snd_soc_jack_report() dereferences the freed dp_jack->jack (use-after-free).
Calling qcom_snd_headset_jack_cleanup(rtd) before returning for the
DisplayPort links clears hcp->jack on unbind.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106054333.2748248-1-tyler.baker@oss.qualcomm.com?part=2

  reply	other threads:[~2026-11-06  6:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  5:43 [PATCH 0/2] ASoC: fix the x1e80100 card after an ADSP restart Tyler Baker
2026-11-06  5:43 ` [PATCH 1/2] ASoC: soc-core: copy the DAI link names into the card Tyler Baker
2026-11-06  5:52   ` sashiko-bot
2026-11-06  5:43 ` [PATCH 2/2] ASoC: qcom: x1e80100: recreate the headset jack on card rebind Tyler Baker
2026-11-06  6:01   ` sashiko-bot [this message]
2026-11-09 12:33 ` [PATCH 0/2] ASoC: fix the x1e80100 card after an ADSP restart 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=sashiko-outbox-200876@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tyler.baker@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.