Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d8d58b2 authored by Chris Wilson's avatar Chris Wilson Committed by Dave Airlie
Browse files

drm/i915: Unlock mutex on i915_gem_fault() error path



If we failed to allocate a new fence register we would return
VM_FAULT_SIGBUS without relinquishing the lock.

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 122ee2a6
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -588,9 +588,11 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
	if (obj_priv->fence_reg == I915_FENCE_REG_NONE &&
	if (obj_priv->fence_reg == I915_FENCE_REG_NONE &&
	    obj_priv->tiling_mode != I915_TILING_NONE) {
	    obj_priv->tiling_mode != I915_TILING_NONE) {
		ret = i915_gem_object_get_fence_reg(obj, write);
		ret = i915_gem_object_get_fence_reg(obj, write);
		if (ret != 0)
		if (ret) {
			mutex_unlock(&dev->struct_mutex);
			return VM_FAULT_SIGBUS;
			return VM_FAULT_SIGBUS;
		}
		}
	}


	pfn = ((dev->agp->base + obj_priv->gtt_offset) >> PAGE_SHIFT) +
	pfn = ((dev->agp->base + obj_priv->gtt_offset) >> PAGE_SHIFT) +
		page_offset;
		page_offset;