dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Johan Hovold" <johan@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/bridge: display-connector: fix i2c adapter leak on probe failure
Date: Fri, 17 Jul 2026 09:10:13 +0000	[thread overview]
Message-ID: <20260717091013.8BBDE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260717085716.1619275-1-johan@kernel.org>

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

Pre-existing issues:
- [High] Missing cancellation of scheduled work (`conn->hpd_work`) in the driver's remove path.
--

--- Patch [1]: [PATCH] drm/bridge: display-connector: fix i2c adapter leak on probe failure ---
commit 4febab97b0e18e24c294244f2f96e39bc66cf4b3
Author: Johan Hovold <johan@kernel.org>

drm/bridge: display-connector: fix i2c adapter leak on probe failure

This commit ensures the i2c adapter device and module references are dropped
on failed regulator and enable gpio lookup during probe by adding a devres
action.

> diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/bridge/display-connector.c
> index d1e74dd2e0518..8415992fcb106 100644
> --- a/drivers/gpu/drm/bridge/display-connector.c
> +++ b/drivers/gpu/drm/bridge/display-connector.c
[ ... ]
> @@ -439,9 +452,6 @@ static void display_connector_remove(struct platform_device *pdev)
>  		regulator_disable(conn->supply);
>  
>  	drm_bridge_remove(&conn->bridge);

[Severity: High]
This isn't a bug introduced by this patch, but does display_connector_remove()
need to cancel conn->hpd_work before returning?

If the display-connector module is unbound concurrently with the DRM master
calling display_connector_hpd_enable(), the hpd_work work item is scheduled.
Without an explicit cancel_work_sync(&conn->hpd_work) here in the remove
path, could the work item execute after the devres subsystem has freed the
conn structure? This would result in a use-after-free when the work item
accesses the freed memory and calls drm_bridge_hpd_notify() on a removed
bridge.

> -
> -	if (!IS_ERR(conn->bridge.ddc))
> -		i2c_put_adapter(conn->bridge.ddc);
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260717085716.1619275-1-johan@kernel.org?part=1

  reply	other threads:[~2026-07-17  9:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  8:57 [PATCH] drm/bridge: display-connector: fix i2c adapter leak on probe failure Johan Hovold
2026-07-17  9:10 ` sashiko-bot [this message]
2026-07-17 12:20 ` Laurent Pinchart
2026-07-17 14:51   ` Johan Hovold
2026-07-17 18:49     ` 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=20260717091013.8BBDE1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=johan@kernel.org \
    --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