diff options
| author | Xi Wang <xi.wang@gmail.com> | 2012-04-23 04:06:42 -0400 |
|---|---|---|
| committer | Luis Henriques <luis.henriques@canonical.com> | 2012-05-25 12:24:35 -0400 |
| commit | af70bc04dc5a6c973d991949be512258371356b1 (patch) | |
| tree | 2717378074c6a2a0c7da2318f5576f109bd2ea6a /drivers/gpu/drm | |
| parent | 45299dc76fb5f70644aa07066c2058a56014317a (diff) | |
drm/i915: fix integer overflow in i915_gem_do_execbuffer()
BugLink: http://bugs.launchpad.net/bugs/996109
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>
Diffstat (limited to 'drivers/gpu/drm')
| -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, | |||
| 1046 | return -EINVAL; | 1046 | return -EINVAL; |
| 1047 | } | 1047 | } |
| 1048 | 1048 | ||
| 1049 | if (args->num_cliprects > UINT_MAX / sizeof(*cliprects)) { | ||
| 1050 | DRM_DEBUG("execbuf with %u cliprects\n", | ||
| 1051 | args->num_cliprects); | ||
| 1052 | return -EINVAL; | ||
| 1053 | } | ||
| 1049 | cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), | 1054 | cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), |
| 1050 | GFP_KERNEL); | 1055 | GFP_KERNEL); |
| 1051 | if (cliprects == NULL) { | 1056 | if (cliprects == NULL) { |
