All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Golle" <daniel@makrotopia.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] drm/bridge: it6505: Don't reject audio hw_params without an encoder
Date: Mon, 20 Jul 2026 16:06:43 +0000	[thread overview]
Message-ID: <20260720160644.4C9581F000E9@smtp.kernel.org> (raw)
In-Reply-To: <11d86a39a66ad81f29bb6d9274419e993d58337a.1784561622.git.daniel@makrotopia.org>

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

Pre-existing issues:
- [High] Missing bounds check for `channel_count == 0` causes an out-of-bounds stack read in `it6505_enable_audio_infoframe`.
- [High] Missing cancellation of workqueues in the driver's remove path leads to Use-After-Free.
--

--- Patch [2]: [PATCH v2 2/2] drm/bridge: it6505: Don't reject audio hw_params without an encoder ---
commit 283dcf1804abd2952ffc7edbd9e7c45ae0570f87
Author: Daniel Golle <daniel@makrotopia.org>

drm/bridge: it6505: Don't reject audio hw_params without an encoder

This commit drops the encoder check in it6505_audio_setup_hw_params() so
stream parameters are always cached. Previously, returning early left
it6505->audio.channel_count at 0, which could cause an out-of-bounds access
if a display was hotplugged while a stream was running.

> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index d84441926e8e0..e20edbbb7c133 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -2979,9 +2979,6 @@ static int it6505_audio_setup_hw_params(struct it6505 *it6505,
>  			     params->sample_rate, params->sample_width,
>  			     params->cea.channels);
>  
> -	if (!it6505->bridge.encoder)
> -		return -ENODEV;
> -

[Severity: High]
This is a pre-existing issue, but if the SoC's I2S controller continuously
drives clocks (e.g. from an active shared speaker backend), could the IT6505
hardware audio FIFO overflow and trigger the INT_AUDIO_FIFO_ERROR interrupt
before ALSA configures the audio stream parameters?

If this happens, it6505_irq_audio_fifo_error() would call
it6505_enable_audio_infoframe() while it6505->audio.channel_count is still 0
(zero-initialized during probe). 

In it6505_enable_audio_infoframe(), it6505->audio.channel_count - 1 evaluates
to -1, causing an out-of-bounds stack read:

    audio_info_ca[it6505->audio.channel_count - 1]);

>  	if (params->cea.channels <= 1 || params->cea.channels > 8) {
>  		DRM_DEV_DEBUG_DRIVER(dev, "channel number: %d not support",
>  				     it6505->audio.channel_count);

[Severity: High]
This is a pre-existing issue, but does the driver's remove path miss cancelling
several workqueues, leading to a potential use-after-free?

In it6505_i2c_remove():

    static void it6505_i2c_remove(struct i2c_client *client)
    {
        struct it6505 *it6505 = i2c_get_clientdata(client);

        platform_device_unregister(it6505->audio_pdev);
        cancel_delayed_work_sync(&it6505->delayed_audio);
        drm_bridge_remove(&it6505->bridge);
        drm_dp_aux_unregister(&it6505->aux);
        it6505_debugfs_remove(it6505);
        it6505_poweroff(it6505);
        it6505_remove_edid(it6505);
    }

Only delayed_audio is explicitly cancelled. 

If other background work items (link_works, hdcp_wait_ksv_list, hdcp_work,
extcon_wq) are pending or running when the device is unbound, could they access
the it6505 structure after it has been automatically freed by devres?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784561622.git.daniel@makrotopia.org?part=2

      reply	other threads:[~2026-07-20 16:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 15:42 [PATCH v2 0/2] drm/bridge: it6505: DP audio support + shared-DAI hw_params fix Daniel Golle
2026-07-20 15:43 ` [PATCH v2 1/2] drm/bridge: it6505: Add audio support Daniel Golle
2026-07-20 16:01   ` sashiko-bot
2026-07-20 15:44 ` [PATCH v2 2/2] drm/bridge: it6505: Don't reject audio hw_params without an encoder Daniel Golle
2026-07-20 16:06   ` 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=20260720160644.4C9581F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=dri-devel@lists.freedesktop.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.