diff options
author | Xi Wang <xi.wang@gmail.com> | 2012-04-23 04:06:42 -0400 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-04-05 09:09:34 +0300 |
commit | 8622f0ea16f1691519cf0f693f0cb9ae99daf583 (patch) | |
tree | e7d565c8183ac76e61f5baee8bb818ebcb132763 | |
parent | a8652cff2457961d631d96188bc5814be592b0fe (diff) | |
download | kernel-mfld-blackbay-8622f0ea16f1691519cf0f693f0cb9ae99daf583.tar.gz kernel-mfld-blackbay-8622f0ea16f1691519cf0f693f0cb9ae99daf583.tar.bz2 kernel-mfld-blackbay-8622f0ea16f1691519cf0f693f0cb9ae99daf583.zip |
drm/i915: fix integer overflow in i915_gem_do_execbuffer()
commit 44afb3a04391a74309d16180d1e4f8386fdfa745 upstream.
On 32-bit systems, a large args->num_cliprects from userspace via ioctl
may overflow the allocation size, leading to out-of-bounds access.
This vulnerability was introduced in commit 432e58ed ("drm/i915: Avoid
allocation for execbuffer object list").
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 71215342724..bc927ae3164 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -1046,6 +1046,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, return -EINVAL; } + if (args->num_cliprects > UINT_MAX / sizeof(*cliprects)) { + DRM_DEBUG("execbuf with %u cliprects\n", + args->num_cliprects); + return -EINVAL; + } cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), GFP_KERNEL); if (cliprects == NULL) { |