Skip to contentSkip to conversation

drm: multiplication overflow in vmw_fence_obj_wait_ioctl()

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

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

PATCH 1/1 drm: multiplication overflow in vmw_fence_obj_wait_ioctl()

From: Yongjian Xu <[email protected]>

arg->time_out_us comes from user-space, then overflow may occur in this line:

	uint64_t wait_timeout = ((uint64_t)arg->timeout_us * HZ);

This is not a serious problem, but still a bug.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +2 -0
index c62d20e..f9b0f8b 100644
@@ -689,6 +689,8 @@ int vmw_fence_obj_wait_ioctl(struct drm_device *dev, void *data,
 	struct vmw_fence_obj *fence;
 	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	int ret;
+	if (arg->timeout_us > (0xffffffffffffffff / HZ))
+		return -EINVAL;
 	uint64_t wait_timeout = ((uint64_t)arg->timeout_us * HZ);
 
 	/*
Signature · 1 line
1.7.9.5