aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2012-09-26 19:15:20 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-09-27 02:45:11 -0400
commit3bc2913e2cb74aac8af90b46fa251dfb8d854665 (patch)
tree888e254ccaf8390dbbd554b30c685c420098913f /drivers/gpu/drm
parent0c96c65b48fba3ffe9822a554cbc0cd610765cd5 (diff)
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/drm')
-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 365a7dc8a4a8..76bbb379d389 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,
3218 enum i915_cache_level level; 3218 enum i915_cache_level level;
3219 int ret; 3219 int ret;
3220 3220
3221 ret = i915_mutex_lock_interruptible(dev);
3222 if (ret)
3223 return ret;
3224
3225 switch (args->caching) { 3221 switch (args->caching) {
3226 case I915_CACHING_NONE: 3222 case I915_CACHING_NONE:
3227 level = I915_CACHE_NONE; 3223 level = I915_CACHE_NONE;
@@ -3233,6 +3229,10 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
3233 return -EINVAL; 3229 return -EINVAL;
3234 } 3230 }
3235 3231
3232 ret = i915_mutex_lock_interruptible(dev);
3233 if (ret)
3234 return ret;
3235
3236 obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle)); 3236 obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
3237 if (&obj->base == NULL) { 3237 if (&obj->base == NULL) {
3238 ret = -ENOENT; 3238 ret = -ENOENT;