Blob Blame History Raw
From: Xiong Zhang <xiong.y.zhang@intel.com>
Date: Tue, 6 Mar 2018 06:07:27 +0800
Subject: drm/i915/gvt: Release gvt->lock at the failure of finding page track
Git-commit: 7e60946feb4287111dc61a13ee66ea4295f4f6b4
Patch-mainline: v4.17-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166

page_track_handler take lock at the beginning, the lock should be released
at the failure of finding page track. Otherwise deadlock will happen.

Fixes: e502a2af4c35 ("drm/i915/gvt: Provide generic page_track infrastructure for write-protected page")
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 drivers/gpu/drm/i915/gvt/page_track.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/i915/gvt/page_track.c
+++ b/drivers/gpu/drm/i915/gvt/page_track.c
@@ -165,7 +165,7 @@ int intel_vgpu_page_track_handler(struct
 
 	page_track = intel_vgpu_find_page_track(vgpu, gpa >> PAGE_SHIFT);
 	if (!page_track)
-		return 0;
+		goto out;
 
 	if (unlikely(vgpu->failsafe)) {
 		/* Remove write protection to prevent furture traps. */
@@ -176,6 +176,7 @@ int intel_vgpu_page_track_handler(struct
 			gvt_err("guest page write error, gpa %llx\n", gpa);
 	}
 
+out:
 	mutex_unlock(&gvt->lock);
 	return ret;
 }