From: sashiko-bot@kernel.org
To: oushixiong1025@163.com
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH RESEND] drm/sysfb: Fix atomic_disable to use dst coordinates instead of src
Date: Tue, 25 Aug 2026 10:53:02 +0000 [thread overview]
Message-ID: <20260825105303.4F2B71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260825104117.667943-1-oushixiong1025@163.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Using the new plane state's unclipped `dst` coordinates in `atomic_disable` fails to clear the actual old plane area and allows arbitrary out-of-bounds memory overwrites.
--
--- Patch [1]: [PATCH RESEND] drm/sysfb: Fix atomic_disable to use dst coordinates instead of src ---
commit 7865516b4b393e248319c8544570c784fcc3881b
Author: oushixiong1025@163.com <oushixiong1025@163.com>
drm/sysfb: Fix atomic_disable to use dst coordinates instead of src
This commit modifies drm_sysfb_plane_helper_atomic_disable() to use the
plane_state->dst coordinates rather than the plane_state->src_* coordinates
for constructing the clear rectangle.
> diff --git a/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c b/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
> index d2de29caf89eb..18466de886aaa 100644
> --- a/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
> +++ b/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
> @@ -380,14 +380,10 @@ void drm_sysfb_plane_helper_atomic_disable(struct drm_plane *plane,
> void __iomem *dst_vmap = dst.vaddr_iomem; /* TODO: Use mapping abstraction */
> unsigned int dst_pitch = sysfb->fb_pitch;
> const struct drm_format_info *dst_format = sysfb->fb_format;
> - struct drm_rect dst_clip;
> + struct drm_rect dst_clip = plane_state->dst;
> unsigned long lines, linepixels, i;
> int idx;
>
> - drm_rect_init(&dst_clip,
> - plane_state->src_x >> 16, plane_state->src_y >> 16,
> - plane_state->src_w >> 16, plane_state->src_h >> 16);
> -
> lines = drm_rect_height(&dst_clip);
> linepixels = drm_rect_width(&dst_clip);
[Severity: Critical]
This isn't a bug introduced by this patch, but can this lead to an
out-of-bounds memory overwrite when userspace provides unclipped coordinates?
During a plane disable (FB_ID = 0), drm_atomic_helper_check_plane_state()
populates plane_state->dst with raw, unclipped userspace values because the
framebuffer is NULL. If userspace passes negative or massive coordinates for
CRTC_X and CRTC_Y, this unclipped dst rectangle is passed to
drm_fb_clip_offset(), resulting in a large out-of-bounds pointer offset.
The driver then executes memset_io() over this invalid offset later in the
function:
dst_vmap += drm_fb_clip_offset(dst_pitch, dst_format, &dst_clip);
for (i = 0; i < lines; ++i) {
memset_io(dst_vmap, 0, linepixels * dst_format->cpp[0]);
Should the disable path use the old plane state rather than the new plane
state to safely clear the actual old plane area?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260825104117.667943-1-oushixiong1025@163.com?part=1
next prev parent reply other threads:[~2026-08-25 10:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 10:41 [PATCH RESEND] drm/sysfb: Fix atomic_disable to use dst coordinates instead of src oushixiong1025
2026-08-25 10:53 ` sashiko-bot [this message]
2026-08-25 11:49 ` 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=20260825105303.4F2B71F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=oushixiong1025@163.com \
--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.