summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2022-10-25 23:19:35 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-07 12:07:37 +0100
commitee8d31836cbe7c26e207bfa0a4a726f0a25cfcf6 (patch)
treed3880255bc0ed8ebc945a0dc12cd4b01580d0ba9
parent080569aa3c505c591a5253f84f76a5a3735a11ea (diff)
downloadlinux-stable-ee8d31836cbe7c26e207bfa0a4a726f0a25cfcf6.tar.gz
linux-stable-ee8d31836cbe7c26e207bfa0a4a726f0a25cfcf6.tar.bz2
linux-stable-ee8d31836cbe7c26e207bfa0a4a726f0a25cfcf6.zip
drm/vmwgfx: Validate the box size for the snooped cursor
commit 4cf949c7fafe21e085a4ee386bb2dade9067316e upstream. Invalid userspace dma surface copies could potentially overflow the memcpy from the surface to the snooped image leading to crashes. To fix it the dimensions of the copybox have to be validated against the expected size of the snooped cursor. Signed-off-by: Zack Rusin <zackr@vmware.com> Fixes: 2ac863719e51 ("vmwgfx: Snoop DMA transfers with non-covering sizes") Cc: <stable@vger.kernel.org> # v3.2+ Reviewed-by: Michael Banack <banackm@vmware.com> Reviewed-by: Martin Krastev <krastevm@vmware.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221026031936.1004280-1-zack@kde.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 39ac7566b705..e6403311ff93 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -301,7 +301,8 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,
if (cmd->dma.guest.ptr.offset % PAGE_SIZE ||
box->x != 0 || box->y != 0 || box->z != 0 ||
box->srcx != 0 || box->srcy != 0 || box->srcz != 0 ||
- box->d != 1 || box_count != 1) {
+ box->d != 1 || box_count != 1 ||
+ box->w > 64 || box->h > 64) {
/* TODO handle none page aligned offsets */
/* TODO handle more dst & src != 0 */
/* TODO handle more then one copy */