From: sashiko-bot@kernel.org
To: "Jonas Karlman" <jonas@kwiboo.se>
Cc: linux-sunxi@lists.linux.dev, Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v5 21/21] drm: bridge: dw_hdmi: Drop call to drm_bridge_hpd_notify()
Date: Tue, 12 May 2026 03:50:26 +0000 [thread overview]
Message-ID: <20260512035027.3AD93C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260510124111.1226584-22-jonas@kwiboo.se>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Removing `drm_bridge_hpd_notify()` violates the DRM bridge API contract, breaks hotplug for non-polling setups, and causes inefficient global polling.
- [High] Teardown asymmetry allows the interrupt handler to re-arm canceled delayed work, leading to a Use-After-Free.
- [High] TOCTOU race condition in asynchronous workqueue leads to Use-After-Free on DRM device teardown.
--
commit ad165e8e6d6f42026d4a0bad754838b6429517bd
Author: Jonas Karlman <jonas@kwiboo.se>
drm: bridge: dw_hdmi: Drop call to drm_bridge_hpd_notify()
This commit drops the call to drm_bridge_hpd_notify() in the HDMI hotplug
delayed work to prevent duplicate hotplug uevents and modesets, relying
solely on drm_helper_hpd_irq_event().
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 2ea8ce5eca367..d9c9d03f8eff2 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -3019,14 +3019,28 @@ static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id)
> static void dw_hdmi_hpd_work(struct work_struct *work)
> {
> struct dw_hdmi *hdmi = container_of(work, struct dw_hdmi, hpd_work.work);
This is an existing issue not introduced by this patch, but does the
delayed work lifecycle have a use-after-free vulnerability during teardown?
If cancel_delayed_work_sync(&hdmi->hpd_work) is called in dw_hdmi_remove()
before hardware interrupts are muted, can dw_hdmi_hardirq() silently
re-arm the workqueue? If the hdmi structure is then freed by devres,
execution of this work function later would cause a use-after-free.
> - enum drm_connector_status status;
>
> if (WARN_ON(!hdmi->bridge.dev))
This is another pre-existing issue, but is there a time-of-check to
time-of-use race condition here?
Since dw_hdmi is an external bridge, its lifetime is independent of the
master DRM device. If the master DRM driver unbinds concurrently, it
could set hdmi->bridge.dev to NULL and free the DRM device.
Could this workqueue evaluate hdmi->bridge.dev as non-NULL, get interrupted,
and then pass a freed DRM device pointer to drm_helper_hpd_irq_event()
below?
> return;
[ ... ]
> drm_helper_hpd_irq_event(hdmi->bridge.dev);
> - status = dw_hdmi_phy_read_hpd(hdmi, hdmi->phy.data);
> - drm_bridge_hpd_notify(&hdmi->bridge, status);
> }
Does removing drm_bridge_hpd_notify() violate the DRM_BRIDGE_OP_HPD
contract and break hotplug functionality for non-polling setups?
Looking at drm_helper_hpd_irq_event(), it immediately returns false if
dev->mode_config.poll_enabled is false. For setups relying strictly on
interrupt-driven bridge hotplug notifications without enabling polling,
would this leave hotplug completely broken?
Additionally, instead of handling just the HDMI port, will
drm_helper_hpd_irq_event() force a synchronous detect() cycle on all
connectors on the DRM device that have the DRM_CONNECTOR_POLL_HPD flag set,
causing an inefficient system-wide poll?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260510124111.1226584-1-jonas@kwiboo.se?part=21
next prev parent reply other threads:[~2026-05-12 3:50 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-10 12:40 [PATCH v5 00/21] drm: bridge: dw_hdmi: Misc enable/disable, CEC and EDID cleanup Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 01/21] drm: bridge: dw_hdmi: Disable scrambler feature when not supported Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 02/21] drm: bridge: dw_hdmi: Only notify connected status on HPD interrupt Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 03/21] drm: bridge: dw_hdmi: Call poweron/poweroff from atomic enable/disable Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-11 22:04 ` sashiko-bot
2026-05-10 12:40 ` [PATCH v5 04/21] drm: bridge: dw_hdmi: Use passed mode instead of stored previous_mode Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 05/21] drm: bridge: dw_hdmi: Fold poweron and setup functions Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 06/21] drm: bridge: dw_hdmi: Remove previous_mode and mode_set Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 07/21] drm: bridge: dw_hdmi: Hold bridge ref until connector cleanup Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 08/21] drm: bridge: dw_hdmi: Unregister CEC notifier during " Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-12 1:41 ` sashiko-bot
2026-05-10 12:40 ` [PATCH v5 09/21] drm: bridge: dw_hdmi: Invalidate CEC phys addr from connector detect Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 10/21] drm: bridge: dw_hdmi: Remove cec_notifier_mutex Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 11/21] drm: bridge: dw_hdmi: Extract dw_hdmi_connector_status_update() Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 12/21] drm: bridge: dw_hdmi: Use dw_hdmi_connector_status_update() Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 13/21] drm: bridge: dw_hdmi: Use display_info is_hdmi and has_audio Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` [PATCH v5 14/21] drm: bridge: dw_hdmi: Use generic CEC notifier helpers Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-12 4:41 ` sashiko-bot
2026-05-10 12:40 ` [PATCH v5 15/21] drm: bridge: dw_hdmi: Add common suspend helper Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-10 12:40 ` Jonas Karlman
2026-05-12 3:35 ` sashiko-bot
2026-05-10 12:41 ` [PATCH v5 16/21] drm: bridge: dw_hdmi: Use delayed_work to debounce hotplug event Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-12 3:32 ` sashiko-bot
2026-05-10 12:41 ` [PATCH v5 17/21] drm: bridge: dw_hdmi: Rework HDP and RXSENSE interrupt handling Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-12 3:51 ` sashiko-bot
2026-05-10 12:41 ` [PATCH v5 18/21] drm: bridge: dw_hdmi: Remove the empty dw_hdmi_setup_rx_sense() Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-10 12:41 ` [PATCH v5 19/21] drm: bridge: dw_hdmi: Remove the empty dw_hdmi_phy_update_hpd() Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-10 12:41 ` [PATCH v5 20/21] drm: bridge: dw_hdmi: Merge top and bottom half IRQ handlers Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-10 12:41 ` [PATCH v5 21/21] drm: bridge: dw_hdmi: Drop call to drm_bridge_hpd_notify() Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-10 12:41 ` Jonas Karlman
2026-05-12 3:50 ` sashiko-bot [this message]
2026-05-15 9:27 ` [PATCH v5 00/21] drm: bridge: dw_hdmi: Misc enable/disable, CEC and EDID cleanup Diederik de Haas
2026-05-15 9:27 ` Diederik de Haas
2026-05-15 9:27 ` Diederik de Haas
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=20260512035027.3AD93C2BCB0@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=jonas@kwiboo.se \
--cc=linux-sunxi@lists.linux.dev \
--cc=sashiko@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.