All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.org, wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v2] drm/bridge: display-connector: Fix I2C adapter resource leak
Date: Fri, 17 Jul 2026 19:01:28 +0000	[thread overview]
Message-ID: <20260717190128.ED10E1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260717184836.2017386-1-laurent.pinchart+renesas@ideasonboard.com>

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

Pre-existing issues:
- [High] Use-After-Free of devm-managed resources (hpd_gpio, hpd_irq) and locking of destroyed mutexes during driver unbind.
--

--- Patch [1]: [PATCH v2] drm/bridge: display-connector: Fix I2C adapter resource leak ---
commit 2b26eaff927cdb68a6ad11049169cdda7d66a1f8
Author: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

drm/bridge: display-connector: Fix I2C adapter resource leak

This commit moves the release of the I2C adapter to the bridge .destroy()
handler to fix a reference leak when probe fails after getting the DDC
adapter.

> diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/bridge/display-connector.c
> --- a/drivers/gpu/drm/bridge/display-connector.c
> +++ b/drivers/gpu/drm/bridge/display-connector.c

[ ... ]

> @@ -439,9 +447,6 @@ static void display_connector_remove(struct platform_device *pdev)
>  		regulator_disable(conn->supply);
>  
>  	drm_bridge_remove(&conn->bridge);

[Severity: High]
This is a pre-existing issue, but does the bridge removal sequence leave
devm-managed resources vulnerable to a use-after-free?

If the driver is unbound while the bridge is still attached to a DRM encoder,
drm_bridge_remove() destroys bridge->hpd_mutex and moves the bridge to a
lingering list. Because hpd_gpio and hpd_irq are devm-managed, devres will
free them as soon as display_connector_remove() returns.

Could an incoming HPD interrupt fire right after drm_bridge_remove() and try
to lock the destroyed bridge->hpd_mutex via drm_bridge_hpd_notify()?

Additionally, if the DRM core later calls display_connector_detect() or
display_connector_hpd_disable() on the lingering bridge, would it result in a
use-after-free when accessing the freed conn->hpd_gpio or conn->hpd_irq?

> -
> -	if (!IS_ERR(conn->bridge.ddc))
> -		i2c_put_adapter(conn->bridge.ddc);
>  }
>  
>  static const struct of_device_id display_connector_match[] = {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260717184836.2017386-1-laurent.pinchart+renesas@ideasonboard.com?part=1

  reply	other threads:[~2026-07-17 19:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 18:48 [PATCH v2] drm/bridge: display-connector: Fix I2C adapter resource leak Laurent Pinchart
2026-07-17 19:01 ` sashiko-bot [this message]
2026-07-17 20:23   ` Laurent Pinchart

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=20260717190128.ED10E1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /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.