From: Zack Rusin Date: Wed, 26 Oct 2022 03:19:35 +0000 (-0400) Subject: drm/vmwgfx: Validate the box size for the snooped cursor X-Git-Tag: archive/raspbian/5.10.162-1+rpi1^2~21 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=97fc19ca15732b60240d365aa287f20e4e1249bb;p=linux.git drm/vmwgfx: Validate the box size for the snooped cursor Origin: https://git.kernel.org/linus/4cf949c7fafe21e085a4ee386bb2dade9067316e Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2022-36280 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 Fixes: 2ac863719e51 ("vmwgfx: Snoop DMA transfers with non-covering sizes") Cc: # v3.2+ Reviewed-by: Michael Banack Reviewed-by: Martin Krastev Link: https://patchwork.freedesktop.org/patch/msgid/20221026031936.1004280-1-zack@kde.org Gbp-Pq: Topic bugfix/x86 Gbp-Pq: Name drm-vmwgfx-Validate-the-box-size-for-the-snooped-cur.patch --- diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index e58112997c8..0e963fd7db1 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -182,7 +182,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 */