From: sashiko-bot@kernel.org
To: "Ze Huang" <ze.huang@oss.qualcomm.com>
Cc: Frank.Li@kernel.org, dri-devel@lists.freedesktop.org,
imx@lists.linux.dev
Subject: Re: [PATCH 1/9] drm/arcpgu: replace struct drm_simple_display_pipe with regular atomic helpers
Date: Sat, 04 Jul 2026 18:43:03 +0000 [thread overview]
Message-ID: <20260704184304.6567A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260705-drm-simple-kms-removal-v1-1-b4e1ca053623@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [High] NULL pointer dereference when enabling CRTC without a primary plane framebuffer.
Pre-existing issues:
- [High] Unsafe direct access of global plane and CRTC state pointers in atomic commit callbacks.
--
commit 6344532446cab68117e44660f110ef0c8aec15d7
Author: Ze Huang <ze.huang@oss.qualcomm.com>
drm/arcpgu: replace struct drm_simple_display_pipe with regular atomic helpers
This commit replaces drm_simple_display_pipe with regular atomic helpers.
It instantiates the plane, CRTC, and encoder directly, wiring them up with
standard atomic helpers to remove the dependency on the simple-KMS interface.
> diff --git a/drivers/gpu/drm/tiny/arcpgu.c b/drivers/gpu/drm/tiny/arcpgu.c
> index c93d61ac0bb75..375cdb79e4e89 100644
> --- a/drivers/gpu/drm/tiny/arcpgu.c
> +++ b/drivers/gpu/drm/tiny/arcpgu.c
[ ... ]
> @@ -117,7 +117,7 @@ static const u32 arc_pgu_supported_formats[] = {
>
> static void arc_pgu_set_pxl_fmt(struct arcpgu_drm_private *arcpgu)
> {
> - const struct drm_framebuffer *fb = arcpgu->pipe.plane.state->fb;
> + const struct drm_framebuffer *fb = arcpgu->plane.state->fb;
[Severity: High]
This isn't a bug introduced by this patch, but does reading the global
plane->state pointer here instead of using the state passed via the
drm_atomic_commit parameter cause issues during non-blocking atomic commits?
If multiple non-blocking commits are queued rapidly, the global pointers
advance to the newest state. When the first commit's commit_tail finally
executes, reading plane->state directly instead of extracting the specific
commit's state could cause the older commit to program the hardware using a
future commit's state.
[Severity: High]
Can this dereference a NULL pointer if the CRTC is enabled without a primary
plane framebuffer?
The transition from drm_simple_display_pipe to generic atomic helpers removed
the underlying protection that previously prevented the CRTC from enabling
without a valid framebuffer. If userspace performs an atomic commit that
enables the CRTC but sets the primary plane's framebuffer to 0 (NULL),
drm_atomic_helper_check_crtc_primary_plane verifies the plane is attached but
does not enforce plane_state->fb != NULL.
This would allow the commit to proceed to arcpgu_crtc_helper_atomic_enable(),
which calls arc_pgu_mode_set(), and then arc_pgu_set_pxl_fmt(), blindly
dereferencing fb->format->format here.
> uint32_t pixel_format = fb->format->format;
> u32 format = DRM_FORMAT_INVALID;
> int i;
[ ... ]
> @@ -155,7 +155,7 @@ static enum drm_mode_status arc_pgu_mode_valid(struct drm_simple_display_pipe *p
>
> static void arc_pgu_mode_set(struct arcpgu_drm_private *arcpgu)
> {
> - struct drm_display_mode *m = &arcpgu->pipe.crtc.state->adjusted_mode;
> + struct drm_display_mode *m = &arcpgu->crtc.state->adjusted_mode;
[Severity: High]
This is a pre-existing issue, but could reading the global crtc->state pointer
directly cause hardware state corruption or frame tearing?
Similar to the plane state issue above, if rapid non-blocking atomic commits
are generated, arc_pgu_mode_set() might read from the newest global state
rather than the specific commit's state object.
> u32 val;
>
> arc_pgu_write(arcpgu, ARCPGU_REG_FMT,
[ ... ]
> @@ -218,35 +218,106 @@ static void arc_pgu_disable(struct drm_simple_display_pipe *pipe)
> ~ARCPGU_CTRL_ENABLE_MASK);
> }
>
> -static void arc_pgu_update(struct drm_simple_display_pipe *pipe,
> - struct drm_plane_state *state)
> +static void arcpgu_plane_helper_atomic_update(struct drm_plane *plane,
> + struct drm_atomic_commit *state)
> {
> struct arcpgu_drm_private *arcpgu;
> struct drm_gem_dma_object *gem;
>
> - if (!pipe->plane.state->fb)
> + if (!plane->state->fb)
[Severity: High]
This is a pre-existing issue, but does arcpgu_plane_helper_atomic_update()
safely handle non-blocking atomic commits when reading plane->state->fb
directly?
Reading the global plane->state pointer instead of extracting the new plane
state from the drm_atomic_commit parameter could result in the same race
condition during asynchronous commit_tail execution.
> return;
>
> - arcpgu = pipe_to_arcpgu_priv(pipe);
> - gem = drm_fb_dma_get_gem_obj(pipe->plane.state->fb, 0);
> + arcpgu = dev_to_arcpgu(plane->dev);
> + gem = drm_fb_dma_get_gem_obj(plane->state->fb, 0);
> arc_pgu_write(arcpgu, ARCPGU_REG_BUF0_ADDR, gem->dma_addr);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260705-drm-simple-kms-removal-v1-0-b4e1ca053623@oss.qualcomm.com?part=1
next prev parent reply other threads:[~2026-07-04 18:43 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 18:31 [PATCH 0/9] drm: replace simple display pipe users with atomic helpers Ze Huang
2026-07-04 18:31 ` [PATCH 1/9] drm/arcpgu: replace struct drm_simple_display_pipe with regular " Ze Huang
2026-07-04 18:43 ` sashiko-bot [this message]
2026-07-06 7:43 ` Thomas Zimmermann
2026-07-06 8:01 ` Thomas Zimmermann
2026-07-06 13:26 ` Ze Huang
2026-07-04 18:31 ` [PATCH 2/9] drm/aspeed: " Ze Huang
2026-07-04 18:52 ` sashiko-bot
2026-07-06 8:31 ` Thomas Zimmermann
2026-07-06 13:32 ` Ze Huang
2026-07-04 18:31 ` [PATCH 3/9] drm/imx: " Ze Huang
2026-07-04 18:46 ` sashiko-bot
2026-07-08 13:02 ` Ze Huang
2026-07-08 12:44 ` Thomas Zimmermann
2026-07-08 13:07 ` Ze Huang
2026-07-04 18:31 ` [PATCH 4/9] drm/mcde: " Ze Huang
2026-07-04 18:44 ` sashiko-bot
2026-07-08 14:44 ` Ze Huang
2026-07-08 13:02 ` Thomas Zimmermann
2026-07-08 14:04 ` Ze Huang
2026-07-04 18:31 ` [PATCH 5/9] drm/pl111: " Ze Huang
2026-07-04 18:45 ` sashiko-bot
2026-07-08 13:03 ` Thomas Zimmermann
2026-07-08 14:46 ` Ze Huang
2026-07-04 18:31 ` [PATCH 6/9] drm/gm12u320: " Ze Huang
2026-07-04 18:45 ` sashiko-bot
2026-07-10 9:20 ` Thomas Zimmermann
2026-07-10 9:26 ` Thomas Zimmermann
2026-07-10 9:09 ` Thomas Zimmermann
2026-07-10 9:21 ` Thomas Zimmermann
2026-07-04 18:31 ` [PATCH 7/9] drm/repaper: " Ze Huang
2026-07-04 18:31 ` [PATCH 8/9] drm/tve200: " Ze Huang
2026-07-04 18:46 ` sashiko-bot
2026-07-08 15:17 ` Ze Huang
2026-07-04 18:31 ` [PATCH 9/9] drm/xen: " Ze Huang
2026-07-04 18:53 ` sashiko-bot
2026-07-08 15:29 ` Ze Huang
2026-07-06 7:27 ` [PATCH 0/9] drm: replace simple display pipe users with " Thomas Zimmermann
2026-07-06 8:22 ` Ze Huang
2026-07-08 12:42 ` Thomas Zimmermann
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=20260704184304.6567A1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=ze.huang@oss.qualcomm.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 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.