Skip to content

Commit 32b415a

Browse files
en4bzzackr
authored andcommitted
drm/vmwgfx: Validate command header size against SVGA_CMD_MAX_DATASIZE
This data originates from userspace and is used in buffer offset calculations which could potentially overflow causing an out-of-bounds access. Fixes: 8ce75f8 ("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
1 parent b750f5a commit 32b415a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,6 +3668,11 @@ static int vmw_cmd_check(struct vmw_private *dev_priv,
36683668

36693669

36703670
cmd_id = header->id;
3671+
if (header->size > SVGA_CMD_MAX_DATASIZE) {
3672+
VMW_DEBUG_USER("SVGA3D command: %d is too big.\n",
3673+
cmd_id + SVGA_3D_CMD_BASE);
3674+
return -E2BIG;
3675+
}
36713676
*size = header->size + sizeof(SVGA3dCmdHeader);
36723677

36733678
cmd_id -= SVGA_3D_CMD_BASE;

0 commit comments

Comments
 (0)