From: sashiko-bot@kernel.org
To: "Zack Rusin" <zack.rusin@broadcom.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 5/6] drm/vmwgfx: validate the framebuffer selected for cursor updates
Date: Tue, 27 Oct 2026 21:39:44 +0000 [thread overview]
Message-ID: <sashiko-outbox-187133@kernel.org> (raw)
In-Reply-To: <20261027211729.646988-6-zack.rusin@broadcom.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/vmwgfx: cursor atomic_check accepts VMW_CURSOR_UPDATE_NONE framebuffers
--
commit 9cca2550f2f0603a47b5047da765ad6aeb14d8cc
Author: Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: validate the framebuffer selected for cursor updates
This commit resolves the user object directly from the selected framebuffer
during cursor plane validation and preparation rather than relying on the
duplicated plane state's previous user object. It also adds checks to reject
zero cursor dimensions and require a backing buffer object for GB-only and
MOB cursor updates.
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
> index f0661e5effeb1..9e8ea9e07f40f 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
[ ... ]
> @@ -763,7 +775,21 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
> if (!fb)
> return 0;
>
> - update_type = vmw_cursor_update_type(vmw, vps);
> + if (!new_state->crtc_w || !new_state->crtc_h) {
> + drm_dbg_kms(&vmw->drm,
> + "Cursor dimensions (%u, %u) must be nonzero\n",
> + new_state->crtc_w, new_state->crtc_h);
> + return -EINVAL;
> + }
> +
> + /* The duplicated plane state's user object still belongs to the old FB. */
> + uo = vmw_cursor_plane_user_object(fb);
> + update_type = vmw_cursor_update_type(vmw, &uo);
> + if ((update_type == VMW_CURSOR_UPDATE_GB_ONLY ||
> + update_type == VMW_CURSOR_UPDATE_MOB) &&
> + !vmw_user_object_buffer(&uo))
> + return -EINVAL;
> +
> if (update_type == VMW_CURSOR_UPDATE_LEGACY) {
> if (new_state->crtc_w != VMW_CURSOR_SNOOP_WIDTH ||
> new_state->crtc_h != VMW_CURSOR_SNOOP_HEIGHT) {
> @@ -772,7 +798,7 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
> new_state->crtc_w, new_state->crtc_h);
> return -EINVAL;
> }
> - surface = vmw_user_object_surface(&vps->uo);
> + surface = vmw_user_object_surface(&uo);
> if (!surface || !surface->snooper.image) {
> drm_warn(&vmw->drm,
> "surface not suitable for cursor\n");
[Severity: Medium]
Can this check for !surface || !surface->snooper.image ever be reached, and
what happens when update_type is VMW_CURSOR_UPDATE_NONE?
Looking at vmw_cursor_update_type(), it only returns VMW_CURSOR_UPDATE_LEGACY
when surface && surface->snooper.image is already true. If vmw->has_mob is
false and the new framebuffer does not have a snooper image (for example, a
BO-backed dumb framebuffer or an atomic client surface where
surface->snooper.image is NULL), vmw_cursor_update_type() returns
VMW_CURSOR_UPDATE_NONE:
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c:vmw_cursor_update_type() {
struct vmw_surface *surface = vmw_user_object_surface(uo);
if (surface && surface->snooper.image)
return VMW_CURSOR_UPDATE_LEGACY;
if (vmw->has_mob) {
if ((vmw->capabilities2 & SVGA_CAP2_CURSOR_MOB) != 0)
return VMW_CURSOR_UPDATE_MOB;
else
return VMW_CURSOR_UPDATE_GB_ONLY;
}
drm_warn_once(&vmw->drm, "Unknown Cursor Type!\n");
return VMW_CURSOR_UPDATE_NONE;
}
When vmw_cursor_update_type() returns VMW_CURSOR_UPDATE_NONE,
vmw_cursor_plane_atomic_check() skips the VMW_CURSOR_UPDATE_LEGACY,
VMW_CURSOR_UPDATE_GB_ONLY, and VMW_CURSOR_UPDATE_MOB branches and returns 0
at the end of the function.
Should vmw_cursor_plane_atomic_check() reject VMW_CURSOR_UPDATE_NONE with
-EINVAL so that non-snooped framebuffers on non-MOB devices are not accepted?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261027211729.646988-1-zack.rusin@broadcom.com?part=5
next prev parent reply other threads:[~2026-10-27 21:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 21:17 [PATCH 0/6] drm/vmwgfx: fix cursor validation and buffer lifetimes Zack Rusin
2026-10-27 21:17 ` [PATCH 1/6] drm/vmwgfx: keep cursor mappings and pins with each plane state Zack Rusin
2026-10-27 21:17 ` [PATCH 2/6] drm/vmwgfx: validate GB-only cursor command limits Zack Rusin
2026-10-27 21:17 ` [PATCH 3/6] drm/vmwgfx: include legacy hotspots in GB-only cursor images Zack Rusin
2026-10-27 21:17 ` [PATCH 4/6] drm/vmwgfx: reserve dumb buffers while detaching their surfaces Zack Rusin
2026-10-27 21:17 ` [PATCH 5/6] drm/vmwgfx: validate the framebuffer selected for cursor updates Zack Rusin
2026-10-27 21:39 ` sashiko-bot [this message]
2026-10-27 21:17 ` [PATCH 6/6] drm/vmwgfx: reserve cursor MOBs before unpinning them Zack Rusin
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-187133@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zack.rusin@broadcom.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.