From: sashiko-bot@kernel.org
To: "Luo Liu" <Luo.Liu@cixtech.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v10 5/5] drm/cix: add the Sky1 DisplayPort platform glue
Date: Fri, 04 Dec 2026 12:01:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-249745@kernel.org> (raw)
In-Reply-To: <20261204114332.280808-6-Luo.Liu@cixtech.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] drm/bridge: trilinear: unlocked device_link_remove() UAF on
dp->dev
- [Medium] drm/bridge: trilinear: missing dp->released check in
dptx_bridge_mode_set()
- [Low] drm/cix: bridge glue placed in top-level drm/cix/ instead of
drm/bridge/
--
commit 1e4145188b36c3532088673583ce49d4b100b5b9
Author: Luo Liu <Luo.Liu@cixtech.com>
drm/cix: add the Sky1 DisplayPort platform glue
This commit adds the Cix Sky1 platform glue driver that maps the RCSU video
adapter registers and binds the shared Trilinear DisplayPort bridge driver.
[ ... ]
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 61111d50b1c65..a1808db8b9c8a 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -311,6 +311,7 @@ source "drivers/gpu/drm/aspeed/Kconfig"
> source "drivers/gpu/drm/ast/Kconfig"
> source "drivers/gpu/drm/atmel-hlcdc/Kconfig"
> source "drivers/gpu/drm/bridge/Kconfig"
> +source "drivers/gpu/drm/cix/Kconfig"
> source "drivers/gpu/drm/etnaviv/Kconfig"
> source "drivers/gpu/drm/exynos/Kconfig"
> source "drivers/gpu/drm/fsl-dcu/Kconfig"
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 2c6bc093a923a..6ed7456bb993a 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -169,6 +169,7 @@ obj-y += tests/
> obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o
> obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o
> obj-y += arm/
> +obj-y += cix/
> obj-y += clients/
> obj-y += display/
> obj-$(CONFIG_DRM_TTM) += ttm/
[Severity: Low]
Should this bridge platform glue live under drivers/gpu/drm/bridge/ (or
drivers/gpu/drm/bridge/trilinear/) rather than a new top-level
drivers/gpu/drm/cix/ directory?
drivers/gpu/drm/cix/ contains no drm_driver, only a single 181-line wrapper
for the Trilinear bridge driver. Putting it at the top level exposes
DRM_CIX_DP outside the Display Interface Bridges menu and adds four extra
Kconfig/Makefile files, whereas comparable SoC bridge wrappers such as
drivers/gpu/drm/bridge/th1520-dw-hdmi.c and
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.c sit under
drivers/gpu/drm/bridge/.
[ ... ]
> diff --git a/drivers/gpu/drm/cix/dptx/cix_dptx.c b/drivers/gpu/drm/cix/dptx/cix_dptx.c
> new file mode 100644
> index 0000000000000..e25b3b365d7b8
> --- /dev/null
> +++ b/drivers/gpu/drm/cix/dptx/cix_dptx.c
[ ... ]
> +static void cix_dptx_remove(struct platform_device *pdev)
> +{
> + trilinear_dptx_remove(platform_get_drvdata(pdev));
> +}
[Severity: Medium]
Can cix_dptx_remove() allow dp->dev to be freed while dptx_bridge_detach()
is still about to pass it to device_link_remove()?
CPU0 (bridge detach) CPU1 (platform device delete)
dptx_bridge_detach()
lock(&dp->lock)
consumer = dp->link_consumer
dp->link_consumer = NULL
unlock(&dp->lock)
device_unregister(dp->dev)
device_del(dp->dev)
cix_dptx_remove()
dptx_deinit()
lock(&dp->lock)
/* link_consumer == NULL */
unlock(&dp->lock)
device_links_purge(dp->dev)
put_device(dp->dev) /* freed */
device_link_remove(consumer,
dp->dev) <-- use-after-free
trilinear_dptx_probe() stores dp->dev without taking a device reference, and
dptx_bridge_attach() adds a DL_FLAG_STATELESS link, so removing the supplier
device does not unbind the consumer first. Because dptx_bridge_detach()
clears dp->link_consumer and drops dp->lock before calling
device_link_remove(), dptx_deinit() returns immediately and device_del()
purges the link and frees dp->dev before device_link_remove() walks
supplier->links.consumers.
Calling device_link_remove() while still holding dp->lock in
dptx_bridge_detach() (matching the dp->lock -> device_links_write_lock
ordering already used in dptx_bridge_attach()) would serialize link removal
with dptx_deinit().
[Severity: Medium]
Can dptx_bridge_mode_set() dereference a freed dp->dev if cix_dptx_remove()
runs between dp->ops->detect() and reacquiring dp->lock?
CPU0 (modeset) CPU1 (platform device delete)
dptx_bridge_mode_set()
dp->ops->detect(dp)
/* locks, checks released,
unlocks */
device_unregister(dp->dev)
cix_dptx_remove()
dptx_deinit()
dp->released = true
device_link_remove(...)
put_device(dp->dev) /* freed */
guard(mutex)(&dp->lock)
/* no dp->released check */
dev_dbg(dp->dev, ...) <-- use-after-free
dptx_bridge_mode_set() releases dp->lock when dp->ops->detect() returns and
does not re-check dp->released after reacquiring it. Because dp->bridge
keeps dp alive after dp->dev is freed, dptx_bridge_mode_set() mutates state
on a released bridge and dereferences freed dp->dev in dev_dbg() when
dynamic debug is enabled.
Checking dp->released and returning -ENODEV immediately after acquiring
dp->lock in dptx_bridge_mode_set() would close this window.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204114332.280808-1-Luo.Liu@cixtech.com?part=5
next prev parent reply other threads:[~2026-12-04 12:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 11:43 [PATCH v10 0/5] drm/bridge: trilinear: add the Sky1 DisplayPort transmitter Luo Liu
2026-12-04 11:43 ` [PATCH v10 1/5] dt-bindings: display: add CIX " Luo Liu
2026-12-04 11:43 ` [PATCH v10 2/5] drm/bridge: trilinear: add the DPTX hardware layer Luo Liu
2026-12-04 12:06 ` sashiko-bot
2026-12-04 11:43 ` [PATCH v10 3/5] drm/bridge: trilinear: add the DPTX DRM bridge Luo Liu
2026-12-04 12:16 ` sashiko-bot
2026-12-04 11:43 ` [PATCH v10 4/5] drm/bridge: trilinear: add the DPTX core and build glue Luo Liu
2026-12-04 12:15 ` sashiko-bot
2026-12-04 11:43 ` [PATCH v10 5/5] drm/cix: add the Sky1 DisplayPort platform glue Luo Liu
2026-12-04 12:01 ` sashiko-bot [this message]
2026-12-04 12:11 ` 回复: " Luo Liu
2026-12-04 12:11 ` Luo Liu
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=sashiko-outbox-249745@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Luo.Liu@cixtech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=robh@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 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.