Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1655497 > unrolled thread

[PATCH 3.2 076/101] drm/vmwgfx: NULL pointer dereference in vmw_surface_define_ioctl()

Started byBen Hutchings <ben@decadent.org.uk>
First post2017-06-01 18:50 +0200
Last post2017-06-01 18:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.2 076/101] drm/vmwgfx: NULL pointer dereference in  vmw_surface_define_ioctl() Ben Hutchings <ben@decadent.org.uk> - 2017-06-01 18:50 +0200

#1655497 — [PATCH 3.2 076/101] drm/vmwgfx: NULL pointer dereference in vmw_surface_define_ioctl()

FromBen Hutchings <ben@decadent.org.uk>
Date2017-06-01 18:50 +0200
Subject[PATCH 3.2 076/101] drm/vmwgfx: NULL pointer dereference in vmw_surface_define_ioctl()
Message-ID<tNBsm-53m-41@gated-at.bofh.it>
3.2.89-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Murray McAllister <murray.mcallister@insomniasec.com>

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.

Signed-off-by: Murray McAllister <murray.mcallister@insomniasec.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -1307,8 +1307,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 +

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web