summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray McAllister <murray.mcallister@gmail.com>2019-05-20 21:57:34 +1200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-22 08:17:20 +0200
commita47f9e9eccaec7110291ea993eccf9c8704275fb (patch)
tree5d301ecafa3dc05e98687676d166f67b06493bfb
parentc867a67ca6473235b7e114ff2367f69d5c3a62bb (diff)
downloadlinux-a47f9e9eccaec7110291ea993eccf9c8704275fb.tar.gz
linux-a47f9e9eccaec7110291ea993eccf9c8704275fb.tar.bz2
linux-a47f9e9eccaec7110291ea993eccf9c8704275fb.zip
drm/vmwgfx: integer underflow in vmw_cmd_dx_set_shader() leading to an invalid read
commit 5ed7f4b5eca11c3c69e7c8b53e4321812bc1ee1e upstream. If SVGA_3D_CMD_DX_SET_SHADER is called with a shader ID of SVGA3D_INVALID_ID, and a shader type of SVGA3D_SHADERTYPE_INVALID, the calculated binding.shader_slot will be 4294967295, leading to an out-of-bounds read in vmw_binding_loc() when the offset is calculated. Cc: <stable@vger.kernel.org> Fixes: d80efd5cb3de ("drm/vmwgfx: Initial DX support") Signed-off-by: Murray McAllister <murray.mcallister@gmail.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 9fe8eda7c859..31da4f288c94 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -2493,7 +2493,8 @@ static int vmw_cmd_dx_set_shader(struct vmw_private *dev_priv,
cmd = container_of(header, typeof(*cmd), header);
- if (cmd->body.type >= SVGA3D_SHADERTYPE_DX10_MAX) {
+ if (cmd->body.type >= SVGA3D_SHADERTYPE_DX10_MAX ||
+ cmd->body.type < SVGA3D_SHADERTYPE_MIN) {
DRM_ERROR("Illegal shader type %u.\n",
(unsigned) cmd->body.type);
return -EINVAL;