dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Michal Wilczynski" <m.wilczynski@samsung.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm/bridge: inno-hdmi: Report hotplug through drm_bridge_hpd_notify()
Date: Fri, 27 Nov 2026 16:27:10 +0000	[thread overview]
Message-ID: <sashiko-outbox-237877@kernel.org> (raw)
In-Reply-To: <20261127-inno-hdmi-ddc-of-node-v1-2-465622e1b7ad@samsung.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/bridge: inno-hdmi: null pointer dereference in
  inno_hdmi_i2c_xfer() [1]
--

commit 95253be01dd44552656110fd639d49c16e43c337
Author: Michal Wilczynski <m.wilczynski@samsung.com>

drm/bridge: inno-hdmi: Report hotplug through drm_bridge_hpd_notify()

This commit changes inno_hdmi_irq() to report hotplug events through
drm_bridge_hpd_notify() and moves devm_request_threaded_irq() in
inno_hdmi_bind() after devm_drm_bridge_add().

> diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c
> index 3bdcacf3cbc84..bbc90ae9eaae0 100644
> --- a/drivers/gpu/drm/bridge/inno-hdmi.c
> +++ b/drivers/gpu/drm/bridge/inno-hdmi.c

[ ... ]

> @@ -1129,6 +1124,16 @@ struct inno_hdmi *inno_hdmi_bind(struct device *dev,
>  	if (ret)
>  		return ERR_PTR(ret);
>  
> +	/*
> +	 * The hotplug handler takes the bridge's HPD mutex, which
> +	 * drm_bridge_add() initialises, so request the interrupt only now.
> +	 */
> +	ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
> +					inno_hdmi_irq, IRQF_SHARED,
> +					dev_name(dev), hdmi);
> +	if (ret)
> +		return ERR_PTR(ret);
> +
>  	ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
>  	if (ret)
>  		return ERR_PTR(ret);

[Severity: High]
This problem wasn't introduced by this patch, but can
inno_hdmi_i2c_adapter() race with a concurrent I2C transfer and cause a
NULL pointer dereference in inno_hdmi_i2c_xfer() [1]?

Just before devm_drm_bridge_add(), inno_hdmi_bind() calls
inno_hdmi_i2c_adapter(), which publishes the adapter via
devm_i2c_add_adapter() before assigning hdmi->i2c:

CPU0                              CPU1
inno_hdmi_i2c_adapter()
  i2c_set_adapdata(adap, hdmi)
  devm_i2c_add_adapter(..., adap)
                                  inno_hdmi_i2c_xfer()
                                    hdmi = i2c_get_adapdata(adap)
                                    i2c = hdmi->i2c  <-- NULL
                                    mutex_lock(&i2c->lock)
  hdmi->i2c = i2c

If a transfer starts right after devm_i2c_add_adapter() registers the
adapter, inno_hdmi_i2c_xfer() reads a NULL hdmi->i2c and dereferences it
in mutex_lock(&i2c->lock).

[1] https://sashiko.dev/#/bug/linux-c25575e8-f25c-439d-83ee-81502085106c

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-inno-hdmi-ddc-of-node-v1-0-465622e1b7ad@samsung.com?part=2

  reply	other threads:[~2026-11-27 16:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261127161904eucas1p1e35356631d4599bbf6b2d02373d3b5b7@eucas1p1.samsung.com>
2026-11-27 16:18 ` [PATCH 0/3] drm/bridge: inno-hdmi: Fix sync polarity, hotplug and DDC adapter Michal Wilczynski
2026-11-27 16:18   ` [PATCH 1/3] drm/bridge: inno-hdmi: fix swapped HSYNC and VSYNC polarity Michal Wilczynski
2026-11-27 16:19   ` [PATCH 2/3] drm/bridge: inno-hdmi: Report hotplug through drm_bridge_hpd_notify() Michal Wilczynski
2026-11-27 16:27     ` sashiko-bot [this message]
2026-11-27 16:19   ` [PATCH 3/3] drm/bridge: inno-hdmi: Don't give the DDC adapter an OF node Michal Wilczynski

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=sashiko-outbox-237877@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=m.wilczynski@samsung.com \
    --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