Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 211232
b: refs/heads/master
c: ce9d419
h: refs/heads/master
v: v3
  • Loading branch information
Chris Wilson committed Oct 3, 2010
1 parent 698297d commit 6635a00
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab7ad7f6451580aa7eccc0ba62807c872088a8f9
refs/heads/master: ce9d419dbecc292cc3e06e8b1d6d123d3fa813a4
28 changes: 20 additions & 8 deletions trunk/drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,15 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
*/
if (args->offset > obj->size || args->size > obj->size ||
args->offset + args->size > obj->size) {
drm_gem_object_unreference_unlocked(obj);
return -EINVAL;
ret = -EINVAL;
goto err;
}

if (!access_ok(VERIFY_WRITE,
(char __user *)(uintptr_t)args->data_ptr,
args->size)) {
ret = -EFAULT;
goto err;
}

if (i915_gem_object_needs_bit17_swizzle(obj)) {
Expand All @@ -490,8 +497,8 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
file_priv);
}

err:
drm_gem_object_unreference_unlocked(obj);

return ret;
}

Expand Down Expand Up @@ -580,8 +587,6 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,

user_data = (char __user *) (uintptr_t) args->data_ptr;
remain = args->size;
if (!access_ok(VERIFY_READ, user_data, remain))
return -EFAULT;


mutex_lock(&dev->struct_mutex);
Expand Down Expand Up @@ -940,8 +945,15 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
*/
if (args->offset > obj->size || args->size > obj->size ||
args->offset + args->size > obj->size) {
drm_gem_object_unreference_unlocked(obj);
return -EINVAL;
ret = -EINVAL;
goto err;
}

if (!access_ok(VERIFY_READ,
(char __user *)(uintptr_t)args->data_ptr,
args->size)) {
ret = -EFAULT;
goto err;
}

/* We can only do the GTT pwrite on untiled buffers, as otherwise
Expand Down Expand Up @@ -975,8 +987,8 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
DRM_INFO("pwrite failed %d\n", ret);
#endif

err:
drm_gem_object_unreference_unlocked(obj);

return ret;
}

Expand Down

0 comments on commit 6635a00

Please sign in to comment.