Skip to contentSkip to conversation

Patch "drm/vmwgfx: Potential off by one in vmw_view_add()" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 13, 2018

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

drm/vmwgfx: Potential off by one in vmw_view_add()

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drm-vmwgfx-potential-off-by-one-in-vmw_view_add.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 0d9cac0ca0429830c40fe1a4e50e60f6221fd7b6 Mon Sep 17 00:00:00 2001

From: Dan Carpenter <[email protected]>
Date: Wed, 10 Jan 2018 12:40:04 +0300
Subject: drm/vmwgfx: Potential off by one in vmw_view_add()

From: Dan Carpenter <[email protected]>

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")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +2 -0
@@ -2729,6 +2729,8 @@ static int vmw_cmd_dx_view_define(struct
 	}
 
 	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,

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/drm-vmwgfx-potential-off-by-one-in-vmw_view_add.patch