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 v11 40/74] drm/rockchip: dw_hdmi_qp: Use dw_hdmi_qp_hpd_notify() for HPD reports
Date: Tue, 01 Sep 2026 20:05:33 +0000 [thread overview]
Message-ID: <20260901200533.9081B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901-dw-hdmi-qp-scramb-v11-40-bc12954a0688@collabora.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Lifetime mismatch between drmm_ allocated state and devm_ managed resources causes Use-After-Free and resource leaks.
--
commit 4f79590505cad08e229d9cf38e2f40905ce2991c
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
drm/rockchip: dw_hdmi_qp: Use dw_hdmi_qp_hpd_notify() for HPD reports
Notify only the affected connector instead of polling all of them, and
ensure .detect_ctx() runs on reconnect to recover SCDC state.
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> index 1c547016ee009..f2a1ea8dfefa5 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
[ ... ]
> @@ -398,14 +397,8 @@ static void dw_hdmi_qp_rk3588_hpd_work(struct work_struct *work)
> struct rockchip_hdmi_qp *hdmi = container_of(work,
> struct rockchip_hdmi_qp,
> hpd_work.work);
> - struct drm_device *drm = hdmi->encoder.encoder.dev;
> - bool changed;
>
> - if (drm) {
> - changed = drm_helper_hpd_irq_event(drm);
> - if (changed)
> - dev_dbg(hdmi->dev, "connector status changed\n");
> - }
> + dw_hdmi_qp_hpd_notify(hdmi->hdmi);
> }
[Severity: High]
This is a pre-existing issue, but can the hpd_work or IRQ handler outlive the
hdmi structure, leading to a use-after-free here?
The hdmi structure is allocated with DRM device lifetime in
dw_hdmi_qp_rockchip_bind():
hdmi = drmm_kzalloc(drm, sizeof(*hdmi), GFP_KERNEL);
However, the IRQ is registered with platform device lifetime:
ret = devm_request_threaded_irq(dev, hdmi->hpd_irq,
cfg->ctrl_ops->hardirq_callback,
cfg->ctrl_ops->irq_callback,
IRQF_NO_AUTOEN, "dw-hdmi-qp-hpd",
hdmi);
During a component unbind (e.g. via sysfs or EPROBE_DEFER),
dw_hdmi_qp_rockchip_unbind() does not explicitly disable the IRQ or unregister
the bridge:
static void dw_hdmi_qp_rockchip_unbind(struct device *dev,
struct device *master,
void *data)
{
struct rockchip_hdmi_qp *hdmi = dev_get_drvdata(dev);
dev_set_drvdata(dev, NULL);
cancel_delayed_work_sync(&hdmi->hpd_work);
}
If the DRM device is freed, the hdmi structure is also freed. But because devm_
resources are tied to the platform device (which isn't removed during a
component unbind), the IRQ remains active.
If a hotplug event fires afterwards, won't it dereference the freed hdmi
pointer and cause a panic?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901-dw-hdmi-qp-scramb-v11-0-bc12954a0688@collabora.com?part=40
next prev parent reply other threads:[~2026-09-01 20:05 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 18:50 [PATCH v11 00/74] Add HDMI 2.0 support to DW HDMI QP TX Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 01/74] video/hdmi: Introduce HDMI version enum Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 02/74] drm/connector: hdmi: Handle reset() state allocation failure Cristian Ciocaltea
2026-09-01 19:07 ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 03/74] drm/display: hdmi: Rename drmm_connector_hdmi_init() to *_ini2() Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 04/74] drm/connector: Add drmm_connector_hdmi_init() with new signature Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 05/74] drm/display: bridge_connector: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 06/74] drm/probe-helper: Introduce .force_ctx() connector callback Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 07/74] drm/connector: Add HDMI 2.0 scrambler infrastructure Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 08/74] drm/display: scdc-helper: Add macro for connector-prefixed debug messages Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 09/74] drm/display: scdc-helper: Add helper to set SCDC version information Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 10/74] drm/display: hdmi: Add HDMI 2.0 scrambling management helpers Cristian Ciocaltea
2026-09-01 19:18 ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 11/74] drm/display: hdmi: Advertise SCDC source version when scrambling Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 12/74] drm/bridge: Fix unlocked list_del in drm_bridge_add() Cristian Ciocaltea
2026-09-01 19:17 ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 13/74] drm/bridge: Fix NULL deref in drm_bridge_add() for legacy bridges Cristian Ciocaltea
2026-09-01 19:19 ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 14/74] drm/bridge: Fix unlocked list access in drm_bridge_attach() Cristian Ciocaltea
2026-09-01 19:16 ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 15/74] drm/bridge: Remove redundant error check in drm_bridge_helper_reset_crtc() Cristian Ciocaltea
2026-09-01 19:21 ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 16/74] drm/bridge: Add bridge ops for source-side HDMI 2.0 scrambling Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 17/74] drm/display: bridge_connector: Use cached connector status in .get_modes() Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 18/74] drm/display: bridge_connector: Switch to .detect_ctx() connector helper Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 19/74] drm/display: bridge_connector: Wire up HDMI 2.0 scrambler callbacks Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 20/74] drm/display: hdmi-state-helper: Add source TMDS rate validation Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 21/74] drm/display: hdmi-state-helper: Pass acquire ctx to hotplug helpers Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 22/74] drm/display: hdmi-state-helper: Add drm_atomic_helper_connector_hdmi_force_ctx() Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 23/74] drm/display: hdmi-state-helper: Sync SCDC state on hotplug Cristian Ciocaltea
2026-09-01 19:40 ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 24/74] drm/display: hdmi-state-helper: Set HDMI scrambling requirement Cristian Ciocaltea
2026-09-01 19:39 ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 25/74] drm/display: bridge_connector: Switch to .force_ctx() connector helper Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 26/74] drm/bridge: dw-hdmi-qp: Rate limit i2c read error messages Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 27/74] drm/bridge: dw-hdmi-qp: Provide .{enable,disable}_hpd() PHY ops Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 28/74] drm/bridge: dw-hdmi-qp: Remove unused workqueue include and define Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 29/74] drm/bridge: dw-hdmi-qp: Add HDMI 2.0 scrambling support Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 30/74] drm/bridge: dw-hdmi-qp: Provide dw_hdmi_qp_hpd_notify() helper Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 31/74] drm/rockchip: dw_hdmi_qp: Fix invalid drvdata access in PM ops Cristian Ciocaltea
2026-09-01 19:46 ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 32/74] drm/rockchip: dw_hdmi_qp: Cancel pending HPD work on suspend Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 33/74] drm/rockchip: dw_hdmi_qp: Add missing newlines in dev_err_probe() messages Cristian Ciocaltea
2026-09-01 19:52 ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 34/74] drm/rockchip: dw_hdmi_qp: Use local dev variable consistently in bind() Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 35/74] drm/rockchip: dw_hdmi_qp: Avoid spurious HPD IRQ thread wakeups Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 36/74] drm/rockchip: dw_hdmi_qp: Mask RK3576 HPD IRQ in io_init Cristian Ciocaltea
2026-09-01 19:50 ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 37/74] drm/rockchip: dw_hdmi_qp: Implement .{enable,disable}_hpd() PHY ops Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 38/74] drm/rockchip: dw_hdmi_qp: Factor out HPD interrupt (un)mask helpers Cristian Ciocaltea
2026-09-01 19:55 ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 39/74] drm/rockchip: dw_hdmi_qp: Control the HPD IRQ line via the bridge HPD ops Cristian Ciocaltea
2026-09-01 20:03 ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 40/74] drm/rockchip: dw_hdmi_qp: Use dw_hdmi_qp_hpd_notify() for HPD reports Cristian Ciocaltea
2026-09-01 20:05 ` sashiko-bot [this message]
2026-09-01 18:51 ` [PATCH v11 41/74] drm/bridge: dw-hdmi-qp: Drop unused .setup_hpd() phy op Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 42/74] drm/vc4: hdmi: Use common TMDS char rate constants Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 43/74] drm/vc4: hdmi: Switch to drm_hdmi_mode_needs_scrambling() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 44/74] drm/vc4: hdmi: Switch to .force_ctx() connector helper Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 45/74] drm/vc4: hdmi: Propagate -EDEADLK to the top level Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 46/74] drm/vc4: hdmi: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 47/74] drm/vc4: hdmi: Convert to common HDMI 2.0 scrambling infrastructure Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 48/74] drm/vc4: hdmi: Defer pixel clock validation to HDMI helpers Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 49/74] drm/display: hdmi-state-helper: Drop drm_atomic_helper_connector_hdmi_force() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 50/74] drm/bridge: adv7511: Advertise HDMI 1.2 capabilities Cristian Ciocaltea
2026-09-01 20:17 ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 51/74] drm/bridge: inno-hdmi: " Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 52/74] drm/bridge: ite-it6263: Drop redundant .mode_valid hook Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 53/74] drm/bridge: ite-it6263: Advertise HDMI 1.3 capabilities Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 54/74] drm/bridge: ite-it66121: Advertise HDMI 1.2 capabilities Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 55/74] drm/bridge: lontium-lt9611: Advertise HDMI 1.4 capabilities Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 56/74] drm/rockchip: rk3066_hdmi: " Cristian Ciocaltea
2026-09-01 20:24 ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 57/74] drm/sun4i: hdmi: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 58/74] drm/tests: edid: Add 4K@60Hz EDID with 600MHz TMDS Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 59/74] drm/tests: edid: Fix conformity for 1080p+4K YUV420 200MHz EDID Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 60/74] drm/tests: edid: Fix conformity for 4K RGB/YUV 340MHz EDID Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 61/74] drm/tests: bridge: Set supported HDMI version Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 62/74] drm/tests: connector: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 63/74] drm/tests: connector: Add HDMI max_tmds_char_rate init coverage Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 64/74] drm/tests: connector: Add HDMI source-side scrambler coverage Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 65/74] drm/tests: hdmi_state_helper: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 66/74] drm/tests: hdmi_state_helper: Add connector-provided max_tmds_char_rate coverage Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 67/74] drm/tests: hdmi_state_helper: Cover source-side scrambling decision Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 68/74] drm/connector: Remove drmm_connector_hdmi_ini2() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 69/74] drm/connector: Drop redundant hdmi vendor/product fields Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 70/74] drm/connector: Drop redundant hdmi supported_formats field Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 71/74] drm/connector: Drop redundant max_bpc field Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 72/74] video/hdmi: Define SPD InfoFrame field lengths and use strtomem_pad() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 73/74] drm/connector: Use the SPD InfoFrame field length defines Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 74/74] drm/tests: hdmi: Add SPD InfoFrame vendor/product coverage Cristian Ciocaltea
2026-09-02 15:28 ` [PATCH v11 00/74] Add HDMI 2.0 support to DW HDMI QP TX Igor Paunovic
2026-09-02 18:00 ` 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=20260901200533.9081B1F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox