From: sashiko-bot@kernel.org
To: "Shirong Zhao" <shxzhaosr@163.com>
Cc: dri-devel@lists.freedesktop.org,
linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH] drm/meson: skip invisible planes in atomic_update
Date: Sat, 05 Dec 2026 02:34:01 +0000 [thread overview]
Message-ID: <sashiko-outbox-250945@kernel.org> (raw)
In-Reply-To: <20261205021754.64-1-shxzhaosr@163.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/meson: invisible plane skip leaves OSD1 enabled causing DMA
UAF
- [Low] drm/meson: Fixes tag cites bbbe775ec5b5 instead of 7db647aa8b13
--
commit 2897024e4c3710997999b1de11959966a195a61b
Author: Shirong Zhao <shxzhaosr@163.com>
> drm/meson: skip invisible planes in atomic_update
>
> meson_plane_atomic_update() computes the scaler phase steps as
>
> hf_phase_step = ((src_w << 18) / dst_w) << 6;
> vf_phase_step = (src_h << 20) / dst_h;
>
> without checking new_state->visible. When userspace submits a zero
> destination size through the atomic ioctl,
> drm_atomic_helper_check_plane_state() marks the plane invisible but
> drm_atomic_helper_commit_planes() still calls ->atomic_update() for a
> plane that keeps its CRTC, so dst_w/dst_h can be 0 and the divisions
> above raise a divide error.
>
> Return early for an invisible plane.
>
> Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
> Signed-off-by: Shirong Zhao <shxzhaosr@163.com>
[Severity: Low]
Should the Fixes tag cite 7db647aa8b13 ("drm/meson: Add primary plane
scaling") instead? Commit bbbe775ec5b5 ("drm: Add support for Amlogic
Meson Graphic Controller") did not have the scaler phase-step divisions
by dst_w and dst_h.
> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index c17afe6712f93..80d685b875a74 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c
> @@ -152,6 +152,15 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
> int vf_bank_len;
> u8 canvas_id_osd1;
>
> + /*
> + * A zero destination size makes the plane invisible, but
> + * drm_atomic_helper_commit_planes() still calls ->atomic_update() for
> + * planes that keep their CRTC. The scaler factor computation below
> + * divides by dst_w/dst_h, so bail out for an invisible plane.
> + */
> + if (!new_state->visible)
> + return;
> +
> /*
> * Update Coordinates
> * Update Formats
[Severity: High]
Does returning early here leave OSD1 enabled and scanning out the
previous framebuffer's DMA address?
When a visible plane becomes invisible while keeping its CRTC,
drm_atomic_helper_commit_planes() skips ->atomic_disable() and calls
meson_plane_atomic_update() instead. Bailing out leaves
priv->viu.osd1_enabled true and priv->viu.osd1_addr set to the old buffer.
meson_crtc_atomic_flush() then still sets priv->viu.osd1_commit, so
meson_crtc_irq() keeps programming OSD1 with that stale address. If the
commit replaced the framebuffer, freeing the old GEM buffer results in a
DMA use-after-free while OSD1 continues scanning it out.
Calling meson_plane_atomic_disable(plane, state) before returning would
disable OSD1 and clear priv->viu.osd1_enabled.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205021754.64-1-shxzhaosr@163.com?part=1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-12-05 2:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 2:17 [PATCH] drm/meson: skip invisible planes in atomic_update Shirong Zhao
2026-12-05 2:34 ` sashiko-bot [this message]
2026-12-05 2:41 ` [PATCH v2] drm/meson: disable OSD1 for " Shirong Zhao
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-250945@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shxzhaosr@163.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