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 v7 04/14] drm/bridge: it6505: unregister DP AUX adapter on bridge detach
Date: Thu, 24 Sep 2026 18:57:25 +0000	[thread overview]
Message-ID: <20260924185725.9BFA61F00893@smtp.kernel.org> (raw)
In-Reply-To: <1bbe09fb84d2cdeb5ff2179749a8769ac79ce77a.1790275151.git.daniel@makrotopia.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/bridge: it6505: regmap UAF on DP AUX access after driver unbind
--

commit 258ee9e0d0d476579fb9e6be277ae45cea6d1cde
Author: Daniel Golle <daniel@makrotopia.org>

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

The DP AUX adapter is registered in .attach() but only unregistered
in i2c remove(), causing registration failure on rebind. This commit
moves the unregistration to .detach() and adds it to the .attach() error path.

> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 9c4aae383c1c5..19bab8d65e222 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
[ ... ]
> @@ -3655,7 +3657,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() from the I2C remove path leave the DP
AUX character device and I2C adapter registered when the driver is unbound?

If the I2C driver is unbound via sysfs (e.g., /sys/bus/i2c/drivers/it6505/unbind)
while the DRM display pipeline remains attached, it6505_i2c_remove() executes
and returns. The driver core then automatically executes devres cleanup,
which destroys it6505->regmap.

Because the DP AUX adapter and its /dev/drm_dp_auxN character device are no
longer unregistered in this path, they remain fully registered and exposed to
userspace.

Any subsequent I/O on the char device will invoke it6505_aux_transfer(),
which calls it6505_aux_do_transfer(). This function unconditionally accesses
the it6505->regmap pointer that was just freed by devres during I2C unbind.

Similarly, any DRM atomic commit triggered by userspace will traverse the
still-attached bridge chain and call bridge callbacks that access the freed
regmap.

Can this lifetime mismatch lead to a use-after-free and memory corruption?

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

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

  reply	other threads:[~2026-09-24 18:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 18:39 [PATCH v7 00/14] drm/bridge: it6505: DP audio support + shared-DAI hw_params fix Daniel Golle
2026-09-24 18:40 ` [PATCH v7 01/14] drm/bridge: it6505: quiesce event sources and work on remove() Daniel Golle
2026-09-24 18:40 ` [PATCH v7 02/14] drm/bridge: it6505: quiesce work items before powering off Daniel Golle
2026-09-24 18:40 ` [PATCH v7 03/14] drm/bridge: it6505: balance and disable runtime PM on remove Daniel Golle
2026-09-24 18:40 ` [PATCH v7 04/14] drm/bridge: it6505: unregister DP AUX adapter on bridge detach Daniel Golle
2026-09-24 18:57   ` sashiko-bot [this message]
2026-09-24 18:40 ` [PATCH v7 05/14] drm/bridge: it6505: complete poweroff even if disabling regulators fails Daniel Golle
2026-09-24 18:49   ` sashiko-bot
2026-09-24 18:40 ` [PATCH v7 06/14] drm/bridge: it6505: bail out of the IRQ handler when status reads fail Daniel Golle
2026-09-24 18:40 ` [PATCH v7 07/14] drm/bridge: it6505: avoid division by zero in pixel clock calculation Daniel Golle
2026-09-24 18:41 ` [PATCH v7 08/14] drm/bridge: it6505: avoid division by zero in audio FS debug print Daniel Golle
2026-09-24 18:41 ` [PATCH v7 09/14] drm/bridge: it6505: guard against zero channel count in audio infoframe Daniel Golle
2026-09-24 18:41 ` [PATCH v7 10/14] drm/bridge: it6505: hold endpoint OF node reference while parsing it Daniel Golle
2026-09-24 18:42 ` [PATCH v7 11/14] drm/bridge: it6505: reject a too short link-frequencies property Daniel Golle
2026-09-24 18:42 ` [PATCH v7 12/14] drm/bridge: it6505: don't write an error code back to the reset register Daniel Golle
2026-09-24 18:42 ` [PATCH v7 13/14] drm/bridge: it6505: Add audio support Daniel Golle
2026-09-24 19:01   ` sashiko-bot
2026-09-24 18:42 ` [PATCH v7 14/14] 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=20260924185725.9BFA61F00893@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.