From: sashiko-bot@kernel.org
To: "Daniel Golle" <daniel@makrotopia.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 1/5] drm/bridge: it6505: quiesce event sources and work on remove()
Date: Wed, 22 Jul 2026 01:18:58 +0000 [thread overview]
Message-ID: <20260722011858.92A721F000E9@smtp.kernel.org> (raw)
In-Reply-To: <a56e30751b6660c5a7e1c4cb1d8e50581a4847dd.1784681487.git.daniel@makrotopia.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] TOCTOU race in it6505_remove_notifier_module() can trigger a devres WARN_ON.
Pre-existing issues:
- [High] State mismatch causing permanently disabled IRQs when regulator_disable() fails in it6505_poweroff().
--
--- Patch [1]: [PATCH v4 1/5] drm/bridge: it6505: quiesce event sources and work on remove() ---
commit edc834b1a3770ae6b495236b92078500aa7563c6
Author: Daniel Golle <daniel@makrotopia.org>
Subject: drm/bridge: it6505: quiesce event sources and work on remove()
This patch tears down the bridge and cancels background work in the correct
order during remove(). It unregisters the extcon notifier and disables
interrupts before cancelling work items to prevent them from requeuing.
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 8ecb43611dba8..7873ae6df3aff 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
[ ... ]
> @@ -2951,13 +2951,14 @@ static int it6505_use_notifier_module(struct it6505 *it6505)
>
> static void it6505_remove_notifier_module(struct it6505 *it6505)
> {
> - if (it6505->extcon) {
> - devm_extcon_unregister_notifier(it6505->dev,
> - it6505->extcon, EXTCON_DISP_DP,
> - &it6505->event_nb);
> + if (!it6505->extcon || !it6505->event_nb.notifier_call)
> + return;
>
> - flush_work(&it6505->extcon_wq);
> - }
> + devm_extcon_unregister_notifier(it6505->dev, it6505->extcon,
> + EXTCON_DISP_DP, &it6505->event_nb);
> + it6505->event_nb.notifier_call = NULL;
[Severity: Medium]
Could this introduce a time-of-check to time-of-use (TOCTOU) race condition?
The commit message mentions making this function idempotent so it can be called
from both .detach() and remove(). However, the check of
it6505->event_nb.notifier_call and its subsequent modification don't appear to
be synchronized.
If .detach() and remove() run concurrently, could both threads pass the check
simultaneously and call devm_extcon_unregister_notifier(), triggering a WARN_ON
in devres_release() due to a double-free attempt?
> +
> + flush_work(&it6505->extcon_wq);
> }
>
[ ... ]
> @@ -3647,6 +3649,12 @@ static void it6505_i2c_remove(struct i2c_client *client)
> drm_bridge_remove(&it6505->bridge);
> drm_dp_aux_unregister(&it6505->aux);
> it6505_debugfs_remove(it6505);
> + it6505_remove_notifier_module(it6505);
> + disable_irq(it6505->irq);
> + cancel_work_sync(&it6505->link_works);
> + cancel_work_sync(&it6505->hdcp_wait_ksv_list);
> + cancel_delayed_work_sync(&it6505->hdcp_work);
> + cancel_work_sync(&it6505->extcon_wq);
> it6505_poweroff(it6505);
[Severity: High]
This isn't a bug introduced by this patch, but could this power off sequence
lead to permanently disabled IRQs?
Looking at it6505_poweroff(), if regulator_disable() fails:
drivers/gpu/drm/bridge/ite-it6505.c:it6505_poweroff() {
...
disable_irq_nosync(it6505->irq);
...
if (pdata->pwr18) {
err = regulator_disable(pdata->pwr18);
if (err)
return err;
}
...
it6505->powered = false;
}
The early return would leave it6505->powered == true despite the IRQ being
disabled.
When the device is powered back on, it6505_poweron() checks the state:
drivers/gpu/drm/bridge/ite-it6505.c:it6505_poweron() {
if (it6505->powered) {
DRM_DEV_DEBUG_DRIVER(dev, "it6505 already powered on");
return 0;
}
...
enable_irq(it6505->irq);
...
}
Would this early return skip enable_irq(), leaving the IRQ permanently disabled
and the hardware deaf to hotplug and link training interrupts?
> it6505_remove_edid(it6505);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784681487.git.daniel@makrotopia.org?part=1
next prev parent reply other threads:[~2026-07-22 1:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 0:58 [PATCH v4 0/5] drm/bridge: it6505: DP audio support + shared-DAI hw_params fix Daniel Golle
2026-07-22 0:59 ` [PATCH v4 1/5] drm/bridge: it6505: quiesce event sources and work on remove() Daniel Golle
2026-07-22 1:18 ` sashiko-bot [this message]
2026-07-22 0:59 ` [PATCH v4 2/5] drm/bridge: it6505: disable runtime PM on remove Daniel Golle
2026-07-22 1:21 ` sashiko-bot
2026-07-22 0:59 ` [PATCH v4 3/5] drm/bridge: it6505: guard against zero channel count in audio infoframe Daniel Golle
2026-07-22 1:16 ` sashiko-bot
2026-07-22 1:00 ` [PATCH v4 4/5] drm/bridge: it6505: Add audio support Daniel Golle
2026-07-22 1:15 ` sashiko-bot
2026-07-22 1:00 ` [PATCH v4 5/5] drm/bridge: it6505: Don't reject audio hw_params without an encoder Daniel Golle
2026-07-22 1:12 ` sashiko-bot
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=20260722011858.92A721F000E9@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.