FAILED: patch "[PATCH] drm/vmwgfx: integer underflow in vmw_cmd_dx_set_shader()" failed to apply to 5.1-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 5.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 5ed7f4b5eca11c3c69e7c8b53e4321812bc1ee1e Mon Sep 17 00:00:00 2001
From: Murray McAllister <[email protected]>
Date: Mon, 20 May 2019 21:57:34 +1200
Subject: [PATCH] drm/vmwgfx: integer underflow in vmw_cmd_dx_set_shader()
leading to an invalid read
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.
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +2 -1
@@ -2206,7 +2206,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 ) {VMW_DEBUG_USER ("Illegal shader type %u.\n" , (unsigned int ) cmd->body.type);return -EINVAL ;