[PATCH] drm/i915: Drop mutex after successful kref_put_mutex()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The kref_put_mutex() returns with the mutex held after freeing the
object - so we must remember to drop it...

Fixes: 69df05e11ab8 ("drm/i915: Simplify releasing context reference")
Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_drv.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ff58583ea757..68b8bf16de57 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3519,9 +3519,10 @@ static inline void i915_gem_context_put(struct i915_gem_context *ctx)
 
 static inline void i915_gem_context_put_unlocked(struct i915_gem_context *ctx)
 {
-	kref_put_mutex(&ctx->ref,
-		       i915_gem_context_free,
-		       &ctx->i915->drm.struct_mutex);
+	struct mutex *lock = &ctx->i915->drm.struct_mutex;
+
+	if (kref_put_mutex(&ctx->ref, i915_gem_context_free, lock))
+		mutex_unlock(lock);
 }
 
 static inline struct intel_timeline *
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux