drm/vmwgfx: Potential off by one in vmw_view_add()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 10 Jan 2018 09:40:04 +0000 (12:40 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Jan 2018 08:45:24 +0000 (09:45 +0100)
commit9fc16b259ac276da269b97f66ad72a5b182c523a
tree5e57ed62280ec95687d3c41d874a272964f93e05
parent2f6ff75e484bca49202cdc132787bc5d29d8a139
drm/vmwgfx: Potential off by one in vmw_view_add()

commit 0d9cac0ca0429830c40fe1a4e50e60f6221fd7b6 upstream.

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 <dan.carpenter@oracle.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c