drm/i915: fix integer overflow in i915_gem_execbuffer2()
Subsystems (3)
PATCH v2 1/2 drm/i915: fix integer overflow in i915_gem_execbuffer2()
On 32-bit systems, a large args->buffer_count from userspace via ioctl may overflow the allocation size, leading to out-of-bounds access.
This vulnerability was introduced in commit 8408c282 ("drm/i915:
First try a normal large kmalloc for the temporary exec buffers").
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -1
@@ -1404,7 +1404,8 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,struct drm_i915_gem_exec_object2 *exec2_list =NULL ;int ret; -if (args->buffer_count <1 ) { +if (args->buffer_count <1 || + args->buffer_count >UINT_MAX /sizeof (*exec2_list)) {DRM_DEBUG ("execbuf2 with %d buffers\n" , args->buffer_count);return -EINVAL ; }
Signature · 1 line
1.7.5.4
PATCH v2 2/2 drm/i915: fix integer overflow in i915_gem_do_execbuffer()
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").
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +5 -0
@@ -1133,6 +1133,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 ) {
Signature · 1 line
1.7.5.4
Re: [PATCH v2 2/2] drm/i915: fix integer overflow in i915_gem_do_execbuffer()
Quoted 9 lines · Xi Wang
On 32-bit systems, a large
args->num_cliprectsfrom 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").
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 9 lines · Xi Wang
On 32-bit systems, a large
args->buffer_countfrom userspace via ioctl may overflow the allocation size, leading to out-of-bounds access.This vulnerability was introduced in commit
8408c282("drm/i915:
First try a normal large kmalloc for the temporary exec buffers").
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 11 lines · Chris Wilson
Quoted 9 lines · Xi Wang
On 32-bit systems, a large
args->buffer_countfrom userspace via ioctl may overflow the allocation size, leading to out-of-bounds access.This vulnerability was introduced in commit
8408c282("drm/i915:
First try a normal large kmalloc for the temporary exec buffers").Reviewed-by Chris Wilson <[email protected]>
Both patches picked up for -fixes, thanks.
-Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48