stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Backport commit bcd6aa7b6cbf ("drm/vmwgfx: NULL pointer dereference from vmw_cmd_dx_view_define()") to linux-4.9-stable
@ 2019-06-16  6:02 Murray McAllister
  0 siblings, 0 replies; only message in thread
From: Murray McAllister @ 2019-06-16  6:02 UTC (permalink / raw)
  To: stable; +Cc: linux-graphics-maintainer, thellstrom, murray.mcallister

Commit bcd6aa7b6cbf ("drm/vmwgfx: NULL pointer dereference
from vmw_cmd_dx_view_define()") upstream.

That commit resolved a NULL pointer dereference in vmw_view_add(),
which occurred if SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW was
called with a surface ID of SVGA3D_INVALID_ID.

(The original patch failed to apply cleanly in 4.9-stable
as VMW_DEBUG_USER does not exist here.)

Signed-off-by: Murray McAllister <murray.mcallister@gmail.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index c7b53d987f06..1e44ac1d6fb3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -2730,6 +2730,10 @@ static int vmw_cmd_dx_view_define(struct vmw_private *dev_priv,
 
 	view_type = vmw_view_cmd_to_type(header->id);
 	cmd = container_of(header, typeof(*cmd), header);
+	if (unlikely(cmd->sid == SVGA3D_INVALID_ID)) {
+		DRM_ERROR("Invalid surface id.\n");
+		return -EINVAL;
+	}
 	ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
 				user_surface_converter,
 				&cmd->sid, &srf_node);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-16  6:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-16  6:02 [PATCH] Backport commit bcd6aa7b6cbf ("drm/vmwgfx: NULL pointer dereference from vmw_cmd_dx_view_define()") to linux-4.9-stable Murray McAllister

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).