From: sashiko-bot@kernel.org
To: syyang@lontium.com
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v13 2/2] drm/bridge: Add Lontium LT7911EXC eDP to MIPI DSI bridge
Date: Fri, 29 May 2026 10:43:29 +0000 [thread overview]
Message-ID: <20260529104329.9BB431F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260529094547.869919-3-syyang@lontium.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] AB-BA / self-deadlock between the bridge's ocm_lock and DRM modeset locks during hotplug notification.
- [High] Freeing the panel bridge in lt7911exc_dsi_host_detach while it is still attached to the DRM bridge chain causes a Use-After-Free.
--
commit ca8c39080d5fa5c9d8946d55f3858864628e4bf7
Author: Sunyun Yang <syyang@lontium.com>
drm/bridge: Add Lontium LT7911EXC eDP to MIPI DSI bridge
This commit adds support for the Lontium LT7911EXC bridge chip which converts
eDP input to MIPI DSI output. It provides DRM bridge integration, MIPI DSI
host interface, firmware upgrade mechanism, and GPIO/regulator management.
> diff --git a/drivers/gpu/drm/bridge/lontium-lt7911exc.c b/drivers/gpu/drm/bridge/lontium-lt7911exc.c
> new file mode 100644
> index 0000000000000..8401b7357b327
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/lontium-lt7911exc.c
[ ... ]
> +static void lt7911exc_firmware_upgrade_work(struct work_struct *work)
> +{
> + struct lt7911exc *lt7911exc = container_of(work, struct lt7911exc, work);
[ ... ]
> + mutex_lock(<7911exc->ocm_lock);
> + lt7911exc_hw_mcu_run(lt7911exc);
> + lt7911exc->fw_version = lt7911exc_read_version(lt7911exc);
> + /* Notify DRM framework that hardware state changed/needs a modeset */
> + if (lt7911exc->bridge.dev)
> + drm_kms_helper_hotplug_event(lt7911exc->bridge.dev);
[Severity: High]
Will this result in a self-deadlock when the hotplug event triggers a modeset?
The driver holds ocm_lock here, and drm_kms_helper_hotplug_event() notifies
user-space and triggers the in-kernel fbdev client to restore the display
mode. This leads to a synchronous atomic commit that invokes bridge
callbacks such as lt7911exc_atomic_pre_enable().
Looking at lt7911exc_atomic_pre_enable():
static void lt7911exc_atomic_pre_enable(...)
{
struct lt7911exc *lt7911exc = bridge_to_lt7911exc(bridge);
guard(mutex)(<7911exc->ocm_lock);
...
}
Since the mutex is already held by this exact same worker thread, and
mutexes aren't recursive, won't this permanently hang the worker thread?
> +
> + mutex_unlock(<7911exc->ocm_lock);
[ ... ]
> +static int lt7911exc_dsi_host_detach(struct mipi_dsi_host *host, struct mipi_dsi_device *dev)
> +{
> + struct lt7911exc *lt7911exc = dsi_host_to_lt7911exc(host);
> +
> + if (!lt7911exc->output.dev)
> + return 0;
> +
> + if (lt7911exc->output.panel && lt7911exc->output.bridge)
> + drm_panel_bridge_remove(lt7911exc->output.bridge);
[Severity: High]
Can this cause a use-after-free during subsequent DRM operations?
In lt7911exc_bridge_attach(), the panel bridge is linked into the DRM
encoder's bridge chain. If the downstream DSI device is unbound at
runtime and calls this detach function, drm_panel_bridge_remove() will
free the panel bridge memory.
However, the bridge is not removed from the encoder's bridge chain
(the chain_node list). Won't subsequent DRM operations like modesets,
display disabling, or device teardown iterate over the encoder's
bridge chain and dereference the freed memory?
> +
> + lt7911exc->output.bridge = NULL;
> + lt7911exc->output.panel = NULL;
> + lt7911exc->output.dev = NULL;
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260529094547.869919-1-syyang@lontium.com?part=2
prev parent reply other threads:[~2026-05-29 10:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 9:45 [PATCH v13 0/2] Add Lontium LT7911EXC eDP to MIPI DSI bridge syyang
2026-05-29 9:45 ` [PATCH v13 1/2] dt-bindings: bridge: " syyang
2026-05-29 9:45 ` [PATCH v13 2/2] drm/bridge: " syyang
2026-05-29 10:43 ` sashiko-bot [this message]
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=20260529104329.9BB431F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=syyang@lontium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox