From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC7CF606A32D for ; Fri, 4 Dec 2026 12:02:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nUfeywyF Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B2E610E6A4; Fri, 4 Dec 2026 12:02:02 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 115ED10E6A4 for ; Fri, 4 Dec 2026 12:01:56 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 157A861DFF; Fri, 4 Dec 2026 12:01:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9132B1F000CE; Fri, 4 Dec 2026 12:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796385714; bh=/J/RDSwjVVr8pxaHgsjz4rMB+wBoxr7o1ujVoE1YspY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=nUfeywyF2hQtx9SG4wKZFo+X9Mz/5c/01We1ErMDy3NYwGz+wBxes/+rwTQfR51kq 4eT5etD9wLNkgcRBiLOILqdMJRvrMNJ+Kbk6ggocxHgoTQ9Xv14Qx9w7NaGTOPXeBB CvDEHM4YgKW3lDP75nwcW+Vl6opfyK6yIlbwLQsCJM745sBlwqJ3sXk+3WvDvwRodo 354TJiP6N5FRr7/cVkHDZGk+gC0kWJkMdfzh3vQ64/9XTQs9snaCLqCUARCVQbOL// mnaw3+ji2Zw34ZFv07Y0++EH0Wq3U/LlaPgksPx51FjUp9unMCoMNr3l6l7ByOk39X e4vIQKFuJp1Kg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v10 5/5] drm/cix: add the Sky1 DisplayPort platform glue To: "Luo Liu" Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261204114332.280808-6-Luo.Liu@cixtech.com> References: <20261204114332.280808-1-Luo.Liu@cixtech.com> <20261204114332.280808-6-Luo.Liu@cixtech.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 12:01:54 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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 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 +=3D tests/ > obj-$(CONFIG_DRM_MIPI_DBI) +=3D drm_mipi_dbi.o > obj-$(CONFIG_DRM_MIPI_DSI) +=3D drm_mipi_dsi.o > obj-y +=3D arm/ > +obj-y +=3D cix/ > obj-y +=3D clients/ > obj-y +=3D display/ > obj-$(CONFIG_DRM_TTM) +=3D 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/dp= tx/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 =3D dp->link_consumer dp->link_consumer =3D NULL unlock(&dp->lock) device_unregister(dp->dev) device_del(dp->dev) cix_dptx_remove() dptx_deinit() lock(&dp->lock) /* link_consumer =3D=3D 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 =3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204114332.2808= 08-1-Luo.Liu@cixtech.com?part=3D5