All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xin Ji" <xji@analogixsemi.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm: anx7625: add I2S input stream right justified control
Date: Tue, 18 Aug 2026 02:13:40 +0000	[thread overview]
Message-ID: <20260818021341.612481F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818020559.961335-2-xji@analogixsemi.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

New issues:
- [Medium] Bypassing standard ALSA HDMI codec DAI format negotiation.
- [Medium] RIGHT_JUSTIFY_CTRL bit is conditionally set but never cleared.

Pre-existing issues:
- [High] Use-After-Free due to interrupt firing after workqueue destruction.
--

--- Patch [2]: [PATCH 2/2] drm: anx7625: add I2S input stream right justified control ---
commit e78186b015f668998903e293729ea71c5bebfbd8
Author: Xin Ji <xji@analogixsemi.com>

drm: anx7625: add I2S input stream right justified control

The default audio data stream is left justify. When the
property "analogix,audio-right-justify-enable" is detected,
the code enables right justify.

> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index fffcd6154c710..d00aa6ea7273d 100644
> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c

[ ... ]

> @@ -2083,6 +2086,12 @@ static int anx7625_audio_hw_params(struct device *dev, void *data,
>  		ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client,
>  				AUDIO_CHANNEL_STATUS_6, ~AUDIO_LAYOUT);
>  
> +	/* Right justified */
> +	if (ctx->pdata.audio_right_justify)

[Severity: Medium]
Instead of bypassing standard ALSA HDMI codec DAI format negotiation,
should this code check the standard fmt->fmt parameter for HDMI_RIGHT_J?

When the driver receives HDMI_RIGHT_J via hdmi_codec_daifmt->fmt at the
start of anx7625_audio_hw_params(), it rejects it with -EINVAL. Relying
on a custom static DT property breaks compatibility with generic ALSA
sound cards that dynamically negotiate the DAI format.

[Severity: Medium]
Is there a missing clear operation for this bit?

If a bootloader or previous kernel execution left the RIGHT_JUSTIFY_CTRL
bit set, and ctx->pdata.audio_right_justify is false, the hardware will
remain in right-justified mode even when standard I2S is expected. Should
there be an anx7625_write_and() to clear the bit on the false path?

> +		ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client,
> +					AUDIO_CONTROL_REGISTER,
> +					RIGHT_JUSTIFY_CTRL);
> +
>  	/* FS */
>  	switch (params->sample_rate) {
>  	case 32000:

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but does the driver have a
use-after-free vulnerability during unbind?

In anx7625_i2c_remove(), the workqueue is destroyed before the interrupt is
disabled:

	if (platform->pdata.intp_irq)
		destroy_workqueue(platform->workqueue);

Because the driver uses devm_request_threaded_irq(), the interrupt is
only freed after remove() returns. If an interrupt (like Hot Plug Detect)
fires after destroy_workqueue(), the ISR anx7625_intr_hpd_isr() will
attempt to use it:

	queue_work(ctx->workqueue, &ctx->work);

Should disable_irq() be called before destroying the workqueue to prevent
the ISR from dereferencing the freed workqueue pointer?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818020559.961335-1-xji@analogixsemi.com?part=2

  reply	other threads:[~2026-08-18  2:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  2:05 [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property Xin Ji
2026-08-18  2:05 ` [PATCH 2/2] drm: anx7625: add I2S input stream right justified control Xin Ji
2026-08-18  2:13   ` sashiko-bot [this message]
2026-08-18  2:12 ` [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property sashiko-bot

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=20260818021341.612481F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xji@analogixsemi.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.