Skip to contentSkip to conversation

drm/i915: release mutex in i915_gem_init()'s error path

PATCH In review Mika Kuoppala 3 participants 4 messages Jan 31, 2014 – Mar 21, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: release mutex in i915_gem_init()'s error path

Found with smatch.

---
 drivers/gpu/drm/i915/i915_gem.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +3 -1
index 08331e1..feedef9 100644
@@ -4536,8 +4536,10 @@ int i915_gem_init(struct drm_device *dev)
 	i915_gem_init_global_gtt(dev);
 
 	ret = i915_gem_context_init(dev);
-	if (ret)
+	if (ret) {
+		mutex_unlock(&dev->struct_mutex);
 		return ret;
+	}
 
 	ret = i915_gem_init_hw(dev);
 	mutex_unlock(&dev->struct_mutex);
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 3 lines · Mika Kuoppala

Found with smatch.

Both smatch patches merged to dinq, thanks.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
Quoted 7 lines · Daniel Vetter
Quoted 3 lines · Mika Kuoppala

Found with smatch.

Both smatch patches merged to dinq, thanks.
-Daniel

CC stable?

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#3 lore raw
Quoted 10 lines · Ben Widawsky
Quoted 7 lines · Daniel Vetter
Quoted 3 lines · Mika Kuoppala

Found with smatch.

Both smatch patches merged to dinq, thanks.
-Daniel

CC stable?

Init tends to rarely blow up, so without a report that this is possible in the wild, nope. Quoting stable kernel rules:

- It must fix a real bug that bothers people (not a, "This could be a problem..." type thing).

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch