]> Git Repo - linux.git/commitdiff
drm/vmwgfx: Potential off by one in vmw_view_add()
authorDan Carpenter <[email protected]>
Wed, 10 Jan 2018 09:40:04 +0000 (12:40 +0300)
committerThomas Hellstrom <[email protected]>
Wed, 10 Jan 2018 14:21:39 +0000 (15:21 +0100)
The vmw_view_cmd_to_type() function returns vmw_view_max (3) on error.
It's one element beyond the end of the vmw_view_cotables[] table.

My read on this is that it's possible to hit this failure.  header->id
comes from vmw_cmd_check() and it's a user controlled number between
1040 and 1225 so we can hit that error.  But I don't have the hardware
to test this code.

Fixes: d80efd5cb3de ("drm/vmwgfx: Initial DX support")
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Thomas Hellstrom <[email protected]>
Cc: <[email protected]>
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

index 21c62a34e5580af7e56505a64bbae48707ae2599..87e8af5776a389166278e24c6087a49f03682dbb 100644 (file)
@@ -2731,6 +2731,8 @@ static int vmw_cmd_dx_view_define(struct vmw_private *dev_priv,
        }
 
        view_type = vmw_view_cmd_to_type(header->id);
+       if (view_type == vmw_view_max)
+               return -EINVAL;
        cmd = container_of(header, typeof(*cmd), header);
        ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
                                user_surface_converter,
This page took 0.077413 seconds and 4 git commands to generate.