All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cristian Ciocaltea" <cristian.ciocaltea@collabora.com>
Cc: linux-sunxi@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v9 29/61] drm/rockchip: dw_hdmi_qp: Implement .{enable,disable}_hpd() PHY ops
Date: Thu, 23 Jul 2026 01:57:31 +0000	[thread overview]
Message-ID: <20260723015731.85AF31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260723-dw-hdmi-qp-scramb-v9-29-4fb12ea22ac9@collabora.com>

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

Pre-existing issues:
- [High] Threaded IRQ handlers unconditionally unmask HPD interrupts and re-queue delayed work, leading to state desync and use-after-free during teardown.
--

--- Patch [29]: [PATCH v9 29/61] drm/rockchip: dw_hdmi_qp: Implement .{enable,disable}_hpd() PHY ops ---
commit 4e3d155ee238497812dbae4f03f0d9c85824af5a
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>

    drm/rockchip: dw_hdmi_qp: Implement .{enable,disable}_hpd() PHY ops

This commit implements the .enable_hpd() and .disable_hpd() phy ops for
RK3576 and RK3588 SoCs. It also consolidates the interrupt clear-and-unmask
and mask-only sequences into these new ops. The .setup_hpd() phy op is removed
as it is no longer needed.

> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> index 12cd8db7cc50b..5067e3cf0e881 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
[ ... ]
> @@ -364,15 +385,11 @@ static irqreturn_t dw_hdmi_qp_rk3576_hardirq(int irq, void *dev_id)
>  static irqreturn_t dw_hdmi_qp_rk3576_irq(int irq, void *dev_id)
>  {
>  	struct rockchip_hdmi_qp *hdmi = dev_id;
> -	u32 val;
>  
> -	val = FIELD_PREP_WM16(RK3576_HDMI_HPD_INT_CLR, 1);
> -	regmap_write(hdmi->regmap, RK3576_IOC_MISC_CON0, val);
>  	mod_delayed_work(system_percpu_wq, &hdmi->hpd_work,
>  			 msecs_to_jiffies(HOTPLUG_DEBOUNCE_MS));
>  
> -	val = FIELD_PREP_WM16(RK3576_HDMI_HPD_INT_MSK, 0);
> -	regmap_write(hdmi->regmap, RK3576_IOC_MISC_CON0, val);
> +	dw_hdmi_qp_rk3576_enable_hpd(NULL, hdmi);

[Severity: High]
This is a pre-existing issue, but this threaded IRQ handler unconditionally
unmasks the HPD interrupt and requeues delayed work.

During teardown or driver unbind, the DRM master is unregistered and drmm
resources (including hdmi) are freed. However, because the devm-managed
IRQ isn't destroyed immediately, the IRQ thread could race with or run after
the DRM core's attempt to mask the interrupt.

This unconditionally calls dw_hdmi_qp_rk3576_enable_hpd(), unmasking the
interrupt again. A subsequent hotplug event could then fire the interrupt and
cause the hardirq handler to access the freed hdmi structure, leading to a
use-after-free crash.

Does this need additional teardown synchronization or checking to ensure we
do not re-enable interrupts and requeue work when unbinding?

>  
>  	return IRQ_HANDLED;
>  }
[ ... ]
> @@ -401,22 +414,11 @@ static irqreturn_t dw_hdmi_qp_rk3588_hardirq(int irq, void *dev_id)
>  static irqreturn_t dw_hdmi_qp_rk3588_irq(int irq, void *dev_id)
>  {
>  	struct rockchip_hdmi_qp *hdmi = dev_id;
> -	u32 val;
> -
> -	if (hdmi->port_id)
> -		val = FIELD_PREP_WM16(RK3588_HDMI1_HPD_INT_CLR, 1);
> -	else
> -		val = FIELD_PREP_WM16(RK3588_HDMI0_HPD_INT_CLR, 1);
> -	regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val);
>  
>  	mod_delayed_work(system_percpu_wq, &hdmi->hpd_work,
>  			 msecs_to_jiffies(HOTPLUG_DEBOUNCE_MS));
>  
> -	if (hdmi->port_id)
> -		val |= FIELD_PREP_WM16(RK3588_HDMI1_HPD_INT_MSK, 0);
> -	else
> -		val |= FIELD_PREP_WM16(RK3588_HDMI0_HPD_INT_MSK, 0);
> -	regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val);
> +	dw_hdmi_qp_rk3588_enable_hpd(NULL, hdmi);

[Severity: High]
This is a pre-existing issue, but this RK3588 IRQ handler exhibits the same
behavior as the RK3576 handler above. 

Can this lead to a use-after-free during driver teardown if the IRQ thread
runs after the DRM core tries to mask the interrupt, causing it to be left
armed?

>  
>  	return IRQ_HANDLED;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260723-dw-hdmi-qp-scramb-v9-0-4fb12ea22ac9@collabora.com?part=29

  reply	other threads:[~2026-07-23  1:57 UTC|newest]

Thread overview: 151+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  1:34 [PATCH v9 00/61] Add HDMI 2.0 support to DW HDMI QP TX Cristian Ciocaltea
2026-07-23  1:34 ` Cristian Ciocaltea
2026-07-23  1:34 ` [PATCH v9 01/61] video/hdmi: Introduce HDMI version enum Cristian Ciocaltea
2026-07-23  1:34   ` Cristian Ciocaltea
2026-07-23  1:34 ` [PATCH v9 02/61] drm/display: hdmi: Rename drmm_connector_hdmi_init() to *_ini2() Cristian Ciocaltea
2026-07-23  1:34   ` Cristian Ciocaltea
2026-07-23  1:34 ` [PATCH v9 03/61] drm/connector: Add drmm_connector_hdmi_init() with new signature Cristian Ciocaltea
2026-07-23  1:34   ` Cristian Ciocaltea
2026-07-23  1:53   ` sashiko-bot
2026-07-23  1:34 ` [PATCH v9 04/61] drm/display: bridge_connector: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-07-23  1:34   ` Cristian Ciocaltea
2026-07-23  1:50   ` sashiko-bot
2026-07-23  1:34 ` [PATCH v9 05/61] drm/connector: Add HDMI 2.0 scrambler infrastructure Cristian Ciocaltea
2026-07-23  1:34   ` Cristian Ciocaltea
2026-07-23  1:51   ` sashiko-bot
2026-07-23  1:34 ` [PATCH v9 06/61] drm/display: scdc-helper: Add macro for connector-prefixed debug messages Cristian Ciocaltea
2026-07-23  1:34   ` Cristian Ciocaltea
2026-07-23  1:34 ` [PATCH v9 07/61] drm/display: scdc-helper: Add helper to set SCDC version information Cristian Ciocaltea
2026-07-23  1:34   ` Cristian Ciocaltea
2026-07-23  1:34 ` [PATCH v9 08/61] drm/display: hdmi: Add HDMI 2.0 scrambling management helpers Cristian Ciocaltea
2026-07-23  1:34   ` Cristian Ciocaltea
2026-07-23  1:51   ` sashiko-bot
2026-07-23  1:34 ` [PATCH v9 09/61] drm/display: hdmi: Advertise SCDC source version when scrambling Cristian Ciocaltea
2026-07-23  1:34   ` Cristian Ciocaltea
2026-07-23  1:34 ` [PATCH v9 10/61] drm/bridge: Remove redundant error check in drm_bridge_helper_reset_crtc() Cristian Ciocaltea
2026-07-23  1:34   ` Cristian Ciocaltea
2026-07-23  1:47   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 11/61] drm/bridge: Add bridge ops for source-side HDMI 2.0 scrambling Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:47   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 12/61] drm/display: bridge_connector: Use cached connector status in .get_modes() Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 13/61] drm/display: bridge_connector: Switch to .detect_ctx() connector helper Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 14/61] drm/display: bridge_connector: Wire up HDMI 2.0 scrambler callbacks Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 15/61] drm/display: hdmi-state-helper: Add source TMDS rate validation Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 16/61] drm/display: hdmi-state-helper: Pass acquire ctx to hotplug helpers Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:51   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 17/61] drm/display: hdmi-state-helper: Sync SCDC state on hotplug Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:53   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 18/61] drm/display: hdmi-state-helper: Set HDMI scrambling requirement Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:50   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 19/61] drm/bridge: dw-hdmi-qp: Rate limit i2c read error messages Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 20/61] drm/bridge: dw-hdmi-qp: Provide .{enable,disable}_hpd() PHY ops Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:52   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 21/61] drm/bridge: dw-hdmi-qp: Remove unused workqueue include and define Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 22/61] drm/bridge: dw-hdmi-qp: Add HDMI 2.0 scrambling support Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 23/61] drm/bridge: dw-hdmi-qp: Provide dw_hdmi_qp_hpd_notify() helper Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:49   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 24/61] drm/rockchip: dw_hdmi_qp: Fix NULL deref in PM ops on incomplete bind Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:48   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 25/61] drm/rockchip: dw_hdmi_qp: Add missing newlines in dev_err_probe() messages Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:48   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 26/61] drm/rockchip: dw_hdmi_qp: Use local dev variable consistently in bind() Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:49   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 27/61] drm/rockchip: dw_hdmi_qp: Avoid spurious HPD IRQ thread wakeups Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:51   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 28/61] drm/rockchip: dw_hdmi_qp: Mask RK3576 HPD IRQ in io_init Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:55   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 29/61] drm/rockchip: dw_hdmi_qp: Implement .{enable,disable}_hpd() PHY ops Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:57   ` sashiko-bot [this message]
2026-07-23  1:35 ` [PATCH v9 30/61] drm/rockchip: dw_hdmi_qp: Factor out HPD interrupt (un)mask helpers Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 31/61] drm/rockchip: dw_hdmi_qp: Control the HPD IRQ line via the bridge HPD ops Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:59   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 32/61] drm/rockchip: dw_hdmi_qp: Use dw_hdmi_qp_hpd_notify() for HPD reports Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:58   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 33/61] drm/bridge: dw-hdmi-qp: Drop unused .setup_hpd() phy op Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 34/61] drm/vc4: hdmi: Use common TMDS char rate constants Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 35/61] drm/vc4: hdmi: Switch to drm_hdmi_mode_needs_scrambling() Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 36/61] drm/vc4: hdmi: Propagate -EDEADLK to the top level Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:59   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 37/61] drm/vc4: hdmi: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 38/61] drm/vc4: hdmi: Convert to common HDMI 2.0 scrambling infrastructure Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 39/61] drm/vc4: hdmi: Defer pixel clock validation to HDMI helpers Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 40/61] drm/bridge: adv7511: Advertise HDMI 1.2 capabilities Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 41/61] drm/bridge: inno-hdmi: " Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 42/61] drm/bridge: ite-it6263: Drop redundant .mode_valid hook Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 43/61] drm/bridge: ite-it6263: Advertise HDMI 1.3 capabilities Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  2:01   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 44/61] drm/bridge: ite-it66121: Advertise HDMI 1.2 capabilities Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 45/61] drm/bridge: lontium-lt9611: Advertise HDMI 1.4 capabilities Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  2:00   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 46/61] drm/rockchip: rk3066_hdmi: " Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:57   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 47/61] drm/sun4i: hdmi: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 48/61] drm/tests: edid: Add 4K@60Hz EDID with 600MHz TMDS Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 49/61] drm/tests: edid: Fix conformity for 1080p+4K YUV420 200MHz EDID Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 50/61] drm/tests: edid: Fix conformity for 4K RGB/YUV 340MHz EDID Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 51/61] drm/tests: bridge: Set supported HDMI version Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 52/61] drm/tests: connector: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 53/61] drm/tests: connector: Add HDMI max_tmds_char_rate init coverage Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:58   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 54/61] drm/tests: connector: Add HDMI source-side scrambler coverage Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  2:00   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 55/61] drm/tests: hdmi_state_helper: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  2:03   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 56/61] drm/tests: hdmi_state_helper: Add connector-provided max_tmds_char_rate coverage Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 57/61] drm/tests: hdmi_state_helper: Cover source-side scrambling decision Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 58/61] drm/connector: Remove drmm_connector_hdmi_ini2() Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  2:01   ` sashiko-bot
2026-07-23  1:35 ` [PATCH v9 59/61] drm/connector: Drop redundant hdmi vendor/product fields Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 60/61] drm/connector: Drop redundant hdmi supported_formats field Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea
2026-07-23  1:35 ` [PATCH v9 61/61] drm/connector: Drop redundant max_bpc field Cristian Ciocaltea
2026-07-23  1:35   ` Cristian Ciocaltea

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=20260723015731.85AF31F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-sunxi@lists.linux.dev \
    --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.