Skip to contentSkip to conversation

drm: integer overflow in vmw_kms_update_layout_ioctl()

PATCH New [email protected] 1 participant 1 message Dec 16, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: integer overflow in vmw_kms_update_layout_ioctl()

From: Yongjian Xu <[email protected]>

rects is copy_from_user.
rects[i].x and rects[i].y are signed.
rects[i].w and rects[i].h are unsigned.
If rects[i].w is large enough, integer overflow could happen in: rects[i].x + rects[i].w rects[i].h has the same problem.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +2 -0
index 03f1c20..edec5f8 100644
@@ -2045,6 +2045,8 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
 	for (i = 0; i < arg->num_outputs; ++i) {
 		if (rects[i].x < 0 ||
 		    rects[i].y < 0 ||
+		    rects[i].w > mode_config->max_width ||
+		    rects[i].h > mode_config->max_height ||
 		    rects[i].x + rects[i].w > mode_config->max_width ||
 		    rects[i].y + rects[i].h > mode_config->max_height) {
 			DRM_ERROR("Invalid GUI layout.\n");
Signature · 1 line
1.7.9.5