From: sashiko-bot@kernel.org
To: "Tomi Valkeinen" <tomi.valkeinen+renesas@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.org,
wsa+renesas@sang-engineering.com, conor+dt@kernel.org,
robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 4/7] drm/rcar-du: dsi: Support DSC in the pipeline
Date: Mon, 15 Jun 2026 06:40:57 +0000 [thread overview]
Message-ID: <20260615064058.481A71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260615-rcar-du-dsc-v4-4-93096a1b56a3@ideasonboard.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unsafe bridge advancement leads to NULL pointer dereference and type confusion
--
commit 1b871953b11e075ad828c5d792325efbdffe6d91
Author: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
drm/rcar-du: dsi: Support DSC in the pipeline
This commit adds checks to rcar_du_crtc_atomic_enable() and disable() to
detect the DSC via the bridge type. It skips the DSC bridge when needed so
that the crtc correctly calls rcar_mipi_dsi_pclk_enable() on the DSI instead
of the DSC.
> diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c
> index 1a246ebbfc613..5679983fc4d1a 100644
> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c
> @@ -754,6 +754,15 @@ static void rcar_du_crtc_atomic_enable(struct drm_crtc *crtc,
[ ... ]
> if ((rcdu->info->dsi_clk_mask & BIT(rcrtc->index)) &&
> (rstate->outputs &
> (BIT(RCAR_DU_OUTPUT_DSI0) | BIT(RCAR_DU_OUTPUT_DSI1)))) {
> struct drm_bridge *bridge = rcdu->dsi[rcrtc->index];
>
> + /*
> + * When we have a DSC block between the DU and the DSI,
> + * the "bridge" points to the DSC. Detect the DSC by looking
> + * at the bridge type, and skip the DSC if the bridge is not
> + * the DSI bridge.
> + */
> + if (bridge->type != DRM_MODE_CONNECTOR_DSI)
> + bridge = bridge->next_bridge;
> +
[Severity: High]
Could this lead to a NULL pointer dereference or type confusion if the device
tree is misconfigured?
If bridge->next_bridge is NULL, passing it to rcar_mipi_dsi_pclk_enable()
would dereference a NULL pointer when it accesses bridge->encoder.
Additionally, if the next bridge exists but is not an rcar_mipi_dsi bridge
(for instance, a generic panel bridge), the container_of() cast in
bridge_to_rcar_mipi_dsi() would result in type confusion and potential
memory corruption.
Should we verify that the new bridge is valid and is actually the expected DSI
bridge before proceeding?
> rcar_mipi_dsi_pclk_enable(bridge, state);
> }
>
> @@ -796,6 +805,15 @@ static void rcar_du_crtc_atomic_disable(struct drm_crtc *crtc,
[ ... ]
> if ((rcdu->info->dsi_clk_mask & BIT(rcrtc->index)) &&
> (rstate->outputs &
> (BIT(RCAR_DU_OUTPUT_DSI0) | BIT(RCAR_DU_OUTPUT_DSI1)))) {
> struct drm_bridge *bridge = rcdu->dsi[rcrtc->index];
>
> + /*
> + * When we have a DSC block between the DU and the DSI,
> + * the "bridge" points to the DSC. Detect the DSC by looking
> + * at the bridge type, and skip the DSC if the bridge is not
> + * the DSI bridge.
> + */
> + if (bridge->type != DRM_MODE_CONNECTOR_DSI)
> + bridge = bridge->next_bridge;
> +
[Severity: High]
Would this have the same risk of a NULL pointer dereference or type confusion
during the disable path when passed to rcar_mipi_dsi_pclk_disable()?
> /*
> * Disable the DSI clock output, see
> * rcar_du_crtc_atomic_enable().
> */
> rcar_mipi_dsi_pclk_disable(bridge);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260615-rcar-du-dsc-v4-0-93096a1b56a3@ideasonboard.com?part=4
next prev parent reply other threads:[~2026-06-15 6:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 6:28 [PATCH v4 0/7] drm/rcar-du: Add support for DSI pipelines with DSC Tomi Valkeinen
2026-06-15 6:28 ` [PATCH v4 1/7] clk: renesas: r8a779g0: Add DSC clock Tomi Valkeinen
2026-06-15 6:28 ` [PATCH v4 2/7] dt-bindings: display: bridge: Document Renesas R-Car V4H DSC bindings Tomi Valkeinen
2026-06-15 6:34 ` sashiko-bot
2026-06-15 6:39 ` Tomi Valkeinen
2026-06-15 9:24 ` Geert Uytterhoeven
2026-06-15 9:38 ` Conor Dooley
2026-06-15 6:28 ` [PATCH v4 3/7] drm/rcar-du: dsc: Add rudimentary Renesas R-Car V4H DSC driver Tomi Valkeinen
2026-06-15 6:40 ` sashiko-bot
2026-06-15 9:16 ` Laurent Pinchart
2026-06-15 6:28 ` [PATCH v4 4/7] drm/rcar-du: dsi: Support DSC in the pipeline Tomi Valkeinen
2026-06-15 6:40 ` sashiko-bot [this message]
2026-06-15 9:19 ` Laurent Pinchart
2026-06-15 6:28 ` [PATCH v4 5/7] arm64: dts: renesas: r8a779g0: Add DSC Tomi Valkeinen
2026-06-15 6:43 ` sashiko-bot
2026-06-15 6:28 ` [PATCH v4 6/7] arm64: dts: renesas: sparrow-hawk: Enable DisplayPort by adding DSC Tomi Valkeinen
2026-06-15 6:43 ` sashiko-bot
2026-06-15 6:28 ` [PATCH v4 7/7] arm64: dts: renesas: white-hawk: Add second mini-DP output support Tomi Valkeinen
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=20260615064058.481A71F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--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 \
--cc=tomi.valkeinen+renesas@ideasonboard.com \
--cc=wsa+renesas@sang-engineering.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