summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2012-09-26 16:15:20 -0700
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-09-27 08:45:11 +0200
commit3bc2913e2cb74aac8af90b46fa251dfb8d854665 (patch)
tree888e254ccaf8390dbbd554b30c685c420098913f /drivers/gpu
parent0c96c65b48fba3ffe9822a554cbc0cd610765cd5 (diff)
downloadop-kernel-dev-3bc2913e2cb74aac8af90b46fa251dfb8d854665.zip
op-kernel-dev-3bc2913e2cb74aac8af90b46fa251dfb8d854665.tar.gz
drm/i915: Fix set_caching locking
On the EINVAL case we don't release struct_mutex. It should be safe to grab the lock after checking the parameters, which also resolves the issues. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 365a7dc..76bbb37 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3218,10 +3218,6 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
enum i915_cache_level level;
int ret;
- ret = i915_mutex_lock_interruptible(dev);
- if (ret)
- return ret;
-
switch (args->caching) {
case I915_CACHING_NONE:
level = I915_CACHE_NONE;
@@ -3233,6 +3229,10 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
return -EINVAL;
}
+ ret = i915_mutex_lock_interruptible(dev);
+ if (ret)
+ return ret;
+
obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
if (&obj->base == NULL) {
ret = -ENOENT;
OpenPOWER on IntegriCloud