]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/vmwgfx: Validate command header size against SVGA_CMD_MAX_DATASIZE
authorIan Forbes <ian.forbes@broadcom.com>
Tue, 21 Oct 2025 19:01:28 +0000 (14:01 -0500)
committerZack Rusin <zack.rusin@broadcom.com>
Fri, 7 Nov 2025 04:59:40 +0000 (23:59 -0500)
This data originates from userspace and is used in buffer offset
calculations which could potentially overflow causing an out-of-bounds
access.

Fixes: 8ce75f8ab904 ("drm/vmwgfx: Update device includes for DX device functionality")
Reported-by: Rohit Keshri <rkeshri@redhat.com>
Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20251021190128.13014-1-ian.forbes@broadcom.com
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

index d539f25b5fbe0ad54a9d5cd35eb112f12469e94e..3057f8baa7d25bbf94b7a93d7ea086b89ab9e84e 100644 (file)
@@ -3668,6 +3668,11 @@ static int vmw_cmd_check(struct vmw_private *dev_priv,
 
 
        cmd_id = header->id;
+       if (header->size > SVGA_CMD_MAX_DATASIZE) {
+               VMW_DEBUG_USER("SVGA3D command: %d is too big.\n",
+                              cmd_id + SVGA_3D_CMD_BASE);
+               return -E2BIG;
+       }
        *size = header->size + sizeof(SVGA3dCmdHeader);
 
        cmd_id -= SVGA_3D_CMD_BASE;