[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1387196202-15125-1-git-send-email-xuyongjiande@gmail.com>
Date: Mon, 16 Dec 2013 20:16:42 +0800
From: xuyongjiande@...il.com
To: airlied@...ux.ie
Cc: linux-kernel@...r.kernel.org, xuyongjian <xuyongjiande@...il.com>
Subject: [PATCH] drm: integer overflow in vmw_surface_define_ioctl()
From: xuyongjian <xuyongjiande@...il.com>
req comes from user-space, then integer overflow may happen in this line:
num_sizes += req->mip_levels[i];
Signed-off-by: xuyongjian <xuyongjiande@...il.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 7de2ea8..5b7c7d2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -678,8 +678,12 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
128;
num_sizes = 0;
- for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i)
+ for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i) {
+ if (req->mip_levels[i] > DRM_VMW_MAX_SURFACE_FACES *
+ DRM_VMW_MAX_MIP_LEVELS)
+ return -EINVAL
num_sizes += req->mip_levels[i];
+ }
if (num_sizes > DRM_VMW_MAX_SURFACE_FACES *
DRM_VMW_MAX_MIP_LEVELS)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists