From: Yongjian@freedesktop.org, Xu@freedesktop.org, xuyongjiande@gmail.com
To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Cc: Yongjian Xu <xuyongjiande@gmail.com>
Subject: [PATCH] drm: multiplication overflow in vmw_fence_obj_wait_ioctl()
Date: Tue, 17 Dec 2013 19:09:54 +0800 [thread overview]
Message-ID: <1387278594-11536-1-git-send-email-xuyongjiande@gmail.com> (raw)
From: Yongjian Xu <xuyongjiande@gmail.com>
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.
Signed-off-by: Yongjian Xu <xuyongjiande@gmail.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index c62d20e..f9b0f8b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -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);
/*
--
1.7.9.5
reply other threads:[~2013-12-17 11:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1387278594-11536-1-git-send-email-xuyongjiande@gmail.com \
--to=yongjian@freedesktop.org \
--cc=Xu@freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xuyongjiande@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).