Skip to contentSkip to conversation

Patch "drm/vmwgfx: NULL pointer dereference in vmw_surface_define_ioctl()" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Apr 9, 2017

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: NULL pointer dereference in vmw_surface_define_ioctl()

to the 4.4-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-null-pointer-dereference-in-vmw_surface_define_ioctl.patch
and it can be found in the queue-4.4 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 36274ab8c596f1240c606bb514da329add2a1bcd Mon Sep 17 00:00:00 2001

From: Murray McAllister <[email protected]>
Date: Mon, 27 Mar 2017 11:12:53 +0200
Subject: drm/vmwgfx: NULL pointer dereference in vmw_surface_define_ioctl()

From: Murray McAllister <[email protected]>

commit 36274ab8c596f1240c606bb514da329add2a1bcd upstream.

Before memory allocations vmw_surface_define_ioctl() checks the upper-bounds of a user-supplied size, but does not check if the supplied size is 0.

Add check to avoid NULL pointer dereferences.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +2 -2
@@ -718,8 +718,8 @@ int vmw_surface_define_ioctl(struct drm_
 	for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i)
 		num_sizes += req->mip_levels[i];
 
-	if (num_sizes > DRM_VMW_MAX_SURFACE_FACES *
-	    DRM_VMW_MAX_MIP_LEVELS)
+	if (num_sizes > DRM_VMW_MAX_SURFACE_FACES * DRM_VMW_MAX_MIP_LEVELS ||
+	    num_sizes == 0)
 		return -EINVAL;
 
 	size = vmw_user_surface_size + 128 +

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

queue-4.4/drm-vmwgfx-avoid-calling-vzalloc-with-a-0-size-in-vmw_get_cap_3d_ioctl.patch queue-4.4/drm-vmwgfx-null-pointer-dereference-in-vmw_surface_define_ioctl.patch