From: sashiko-bot@kernel.org
To: "Michal Wilczynski" <m.wilczynski@samsung.com>
Cc: lee@kernel.org, linux-phy@lists.infradead.org, robh@kernel.org,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com,
mfd@lists.linux.dev, conor+dt@kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 07/19] drm/bridge: inno-hdmi: Split probe out of bind
Date: Fri, 04 Sep 2026 13:42:50 +0000 [thread overview]
Message-ID: <20260904134251.61DAD1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260904-jh7110-clean-send-v3-7-484f9ae72715@samsung.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] Using `devm_` APIs during the component bind phase causes permanent resource leaks and breaks EPROBE_DEFER.
- [High] The hotplug interrupt handler `inno_hdmi_irq` can fire before the bridge is attached, leading to a NULL pointer dereference.
- [High] The I2C adapter is exposed before its private data is initialized, leading to a NULL pointer dereference on concurrent access.
--
commit 72f1334365740cfcdf0865d9dfd6562b9c3b40a8
Author: Michal Wilczynski <m.wilczynski@samsung.com>
Subject: drm/bridge: inno-hdmi: Split probe out of bind
This commit splits the hardware setup of the inno-hdmi driver into a new
inno_hdmi_probe() function. This separates the bridge registration from its
attachment in inno_hdmi_bind(), allowing decoupled MFD/glue drivers to manage
them independently.
> diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c
> index dd35f5a875d3d..aab474740f7f5 100644
> --- a/drivers/gpu/drm/bridge/inno-hdmi.c
> +++ b/drivers/gpu/drm/bridge/inno-hdmi.c
> @@ -1061,11 +1061,24 @@ static struct i2c_adapter *inno_hdmi_i2c_adapter(struct inno_hdmi *hdmi)
> return adap;
> }
[Severity: High]
This is a pre-existing issue, but the I2C adapter is exposed before its private
data is initialized, which can lead to a NULL pointer dereference on concurrent
access.
Just above this line, devm_i2c_add_adapter() makes the bus visible to the system
before hdmi->i2c is assigned:
ret = devm_i2c_add_adapter(hdmi->dev, adap);
if (ret) {
...
}
hdmi->i2c = i2c;
If a concurrent I2C transfer is initiated (e.g. via udev running i2cdetect),
inno_hdmi_i2c_xfer() can be invoked. It will read the uninitialized hdmi->i2c
and attempt to lock its mutex:
drivers/gpu/drm/bridge/inno-hdmi.c:inno_hdmi_i2c_xfer() {
struct inno_hdmi_i2c *i2c = hdmi->i2c;
...
mutex_lock(&i2c->lock);
...
}
Could hdmi->i2c be assigned before calling devm_i2c_add_adapter() to prevent
this race?
> -struct inno_hdmi *inno_hdmi_bind(struct device *dev,
> - struct drm_encoder *encoder,
> - const struct inno_hdmi_plat_data *plat_data)
> +/**
> + * inno_hdmi_probe - Internal helper to perform common setup
> + * @pdev: platform device
> + * @plat_data: SoC-specific platform data
> + *
> + * This function handles all the common hardware setup: allocating the main
> + * struct, mapping registers, getting clocks, initializing the hardware,
> + * setting up the IRQ, and initializing the DDC adapter and bridge struct.
> + * It returns a pointer to the inno_hdmi struct on success, or an ERR_PTR
> + * on failure.
> + *
> + * This function is used by modern, decoupled MFD/glue drivers. It registers
> + * the bridge but does not attach it.
> + */
> +struct inno_hdmi *inno_hdmi_probe(struct platform_device *pdev,
> + const struct inno_hdmi_plat_data *plat_data)
> {
[Severity: High]
This isn't a bug introduced by this patch, but using devm_ APIs in the
component bind phase (now moved to inno_hdmi_probe()) causes permanent
resource leaks and breaks EPROBE_DEFER.
Because inno_hdmi_bind() is called from inno_hdmi_rockchip_bind() (a
component bind callback), the platform device is not removed when a component
unbinds. If another component in the DRM pipeline defers, the devm_ resources
are not freed.
Subsequent bind attempts will fail with -EBUSY when re-requesting the IRQ or
I/O regions:
drivers/gpu/drm/bridge/inno-hdmi.c:inno_hdmi_probe() {
...
ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
inno_hdmi_irq, IRQF_SHARED,
dev_name(dev), hdmi);
...
}
Should this driver be converted to request resources during the actual probe
phase rather than bind?
[ ... ]
> +struct inno_hdmi *inno_hdmi_bind(struct device *dev,
> + struct drm_encoder *encoder,
> + const struct inno_hdmi_plat_data *plat_data)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct inno_hdmi *hdmi;
> + int ret;
> +
> + hdmi = inno_hdmi_probe(pdev, plat_data);
> + if (IS_ERR(hdmi))
> + return hdmi;
> +
> + ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL,
> + DRM_BRIDGE_ATTACH_NO_CONNECTOR);
[Severity: High]
This is a pre-existing issue, but this refactoring significantly widens the race
window for a NULL pointer dereference. The hotplug interrupt handler can fire
before the bridge is attached.
inno_hdmi_probe() unmasks the HPD interrupt and registers the IRQ handler with
devm_request_threaded_irq(). If a monitor is physically connected, the
interrupt can fire immediately.
The IRQ handler then attempts to dereference hdmi->bridge.dev:
drivers/gpu/drm/bridge/inno-hdmi.c:inno_hdmi_irq() {
...
drm_helper_hpd_irq_event(hdmi->bridge.dev);
...
}
However, hdmi->bridge.dev is only assigned when drm_bridge_attach() is called.
Since this patch decouples probe from attach for modern MFD/glue drivers, the
attach phase happens much later, leaving a dangerous race window.
Should the IRQ registration be moved to after the bridge is attached, or should
the IRQ handler check if the bridge is attached before proceeding?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260904-jh7110-clean-send-v3-0-484f9ae72715@samsung.com?part=7
next prev parent reply other threads:[~2026-09-04 13:42 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260904132708eucas1p1adfa26ef0fe5109eca63a3aeadf74915@eucas1p1.samsung.com>
2026-09-04 13:27 ` [PATCH v3 00/19] drm: starfive: jh7110: Enable display subsystem Michal Wilczynski
2026-09-04 13:27 ` [PATCH v3 01/19] dt-bindings: phy: Add starfive,jh7110-inno-hdmi-phy Michal Wilczynski
2026-09-04 13:30 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 02/19] dt-bindings: display: bridge: Add starfive,jh7110-inno-hdmi-controller Michal Wilczynski
2026-09-04 13:35 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 03/19] dt-bindings: mfd: Add starfive,jh7110-hdmi-subsystem Michal Wilczynski
2026-09-04 13:37 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 04/19] dt-bindings: soc: starfive: Add starfive,jh7110-vout-syscon Michal Wilczynski
2026-09-04 13:30 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 05/19] dt-bindings: soc: starfive: Add starfive,jh7110-vout-subsystem Michal Wilczynski
2026-09-04 13:36 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 06/19] dt-bindings: display: verisilicon: Add starfive,jh7110-dc8200 Michal Wilczynski
2026-09-04 13:31 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 07/19] drm/bridge: inno-hdmi: Split probe out of bind Michal Wilczynski
2026-09-04 13:42 ` sashiko-bot [this message]
2026-09-04 13:27 ` [PATCH v3 08/19] drm/bridge: inno-hdmi: Allow the register map to come from a parent Michal Wilczynski
2026-09-04 13:43 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 09/19] drm/bridge: inno-hdmi: Add .disable platform operation Michal Wilczynski
2026-09-04 13:49 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 10/19] drm/bridge: inno-hdmi: Add .mode_valid " Michal Wilczynski
2026-09-04 13:40 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 11/19] soc: starfive: Add jh7110-hdmi-subsystem driver Michal Wilczynski
2026-09-04 13:52 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 12/19] soc: starfive: Add jh7110-vout-subsystem driver Michal Wilczynski
2026-09-04 13:47 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 13/19] clk: starfive: jh7110-vout: Allow pixel clock rate propagation Michal Wilczynski
2026-09-04 13:44 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 14/19] drm/bridge: starfive: Add JH7110 HDMI controller driver Michal Wilczynski
2026-09-04 13:39 ` Icenowy Zheng
2026-09-04 13:57 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 15/19] phy: Add common Innosilicon HDMI PHY helpers Michal Wilczynski
2026-09-04 13:55 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 16/19] phy: rockchip: inno-hdmi: Use the common Innosilicon " Michal Wilczynski
2026-09-04 13:59 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 17/19] phy: starfive: Add jh7110-inno-hdmi-phy driver Michal Wilczynski
2026-09-04 13:57 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 18/19] riscv: dts: starfive: jh7110: Update DT for display subsystem Michal Wilczynski
2026-09-04 14:03 ` sashiko-bot
2026-09-04 13:27 ` [PATCH v3 19/19] MAINTAINERS: Add StarFive JH7110 display subsystem entry Michal Wilczynski
2026-09-04 15:13 ` [PATCH v3 00/19] drm: starfive: jh7110: Enable display subsystem Joshua Peisach
2026-09-05 5:21 ` Maud Spierings
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=20260904134251.61DAD1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lee@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=m.wilczynski@samsung.com \
--cc=mfd@lists.linux.dev \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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