All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Golle" <daniel@makrotopia.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 03/11] drm/bridge: it6505: unregister DP AUX adapter on bridge detach
Date: Wed, 22 Jul 2026 20:46:21 +0000	[thread overview]
Message-ID: <20260722204621.815281F000E9@smtp.kernel.org> (raw)
In-Reply-To: <a472535bc291e77aee5cae71ea2a26d695511fd6.1784717129.git.daniel@makrotopia.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Removing `drm_dp_aux_unregister()` from `it6505_i2c_remove()` introduces a critical Use-After-Free vulnerability if the I2C driver is unbound while the DRM bridge remains attached.
--

--- Patch [3]: [PATCH v5 03/11] drm/bridge: it6505: unregister DP AUX adapter on bridge detach ---
commit b259e088ec0ed97d1f41a3a8463e232914e7c924
Author: Daniel Golle <daniel@makrotopia.org>

drm/bridge: it6505: unregister DP AUX adapter on bridge detach

This commit moves the DP AUX adapter unregistration from the I2C remove
path to the bridge detach and attach error paths. This is intended to
prevent duplicate registrations when unbinding and rebinding the DRM
device.

> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c

[ ... ]

> @@ -3652,7 +3654,6 @@ static void it6505_i2c_remove(struct i2c_client *client)
>  	struct it6505 *it6505 = i2c_get_clientdata(client);
>  
>  	drm_bridge_remove(&it6505->bridge);
> -	drm_dp_aux_unregister(&it6505->aux);

[Severity: High]
Does removing drm_dp_aux_unregister() here introduce a use-after-free
if the I2C driver is unbound while the DRM bridge remains attached?

If the I2C driver is unbound (for example, via sysfs) while the DRM
device is still active, the DP AUX character device (/dev/drm_dp_auxN)
appears to remain registered because drm_bridge_remove() does not invoke
it6505_bridge_detach() when the bridge is removed from the global list.

After it6505_i2c_remove() returns, the driver core's devres cleanup will
execute and free the it6505 structure and its managed resources, such as
the regmap.

If userspace subsequently interacts with the leaked character device,
it can invoke it6505_aux_transfer() which dereferences the freed memory:

drivers/gpu/drm/bridge/ite-it6505.c:it6505_aux_transfer() {
	struct it6505 *it6505 = container_of(aux, struct it6505, aux);
	...
	// accesses freed it6505 and performs I/O on freed it6505->regmap
}

Should drm_dp_aux_unregister() be kept in the I2C remove path as well,
or is there another mechanism guaranteeing the AUX character device is
unregistered before devres cleanup occurs?

>  	it6505_debugfs_remove(it6505);
>  	it6505_remove_notifier_module(it6505);
>  	disable_irq(it6505->irq);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784717129.git.daniel@makrotopia.org?part=3

  reply	other threads:[~2026-07-22 20:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 15:45 [PATCH v5 00/11] drm/bridge: it6505: DP audio support + shared-DAI hw_params fix Daniel Golle
2026-07-22 15:45 ` [PATCH v5 01/11] drm/bridge: it6505: quiesce event sources and work on remove() Daniel Golle
2026-07-22 16:22   ` sashiko-bot
2026-07-22 15:45 ` [PATCH v5 02/11] drm/bridge: it6505: balance and disable runtime PM on remove Daniel Golle
2026-07-22 20:36   ` sashiko-bot
2026-07-22 15:45 ` [PATCH v5 03/11] drm/bridge: it6505: unregister DP AUX adapter on bridge detach Daniel Golle
2026-07-22 20:46   ` sashiko-bot [this message]
2026-07-22 15:46 ` [PATCH v5 04/11] drm/bridge: it6505: complete poweroff even if disabling regulators fails Daniel Golle
2026-07-22 20:58   ` sashiko-bot
2026-07-22 15:46 ` [PATCH v5 05/11] drm/bridge: it6505: bail out of the IRQ handler when status reads fail Daniel Golle
2026-07-22 15:46 ` [PATCH v5 06/11] drm/bridge: it6505: avoid division by zero in pixel clock calculation Daniel Golle
2026-07-22 15:46 ` [PATCH v5 07/11] drm/bridge: it6505: avoid division by zero in audio FS debug print Daniel Golle
2026-07-22 21:23   ` sashiko-bot
2026-07-22 15:47 ` [PATCH v5 08/11] drm/bridge: it6505: guard against zero channel count in audio infoframe Daniel Golle
2026-07-22 15:47 ` [PATCH v5 09/11] drm/bridge: it6505: hold endpoint OF node reference while parsing it Daniel Golle
2026-07-22 21:52   ` sashiko-bot
2026-07-22 15:47 ` [PATCH v5 10/11] drm/bridge: it6505: Add audio support Daniel Golle
2026-07-22 22:07   ` sashiko-bot
2026-07-22 15:47 ` [PATCH v5 11/11] drm/bridge: it6505: Don't reject audio hw_params without an encoder Daniel Golle

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=20260722204621.815281F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=dri-devel@lists.freedesktop.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 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.