aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiong Zhang <xiong.y.zhang@intel.com>2018-03-05 17:07:27 -0500
committerZhenyu Wang <zhenyuw@linux.intel.com>2018-03-06 01:49:24 -0500
commit7e60946feb4287111dc61a13ee66ea4295f4f6b4 (patch)
tree495e4e62ea334ef98e3da7d89ef9f272057662c1
parent6846dfeb87a623e0bf31df4b6a7041d70277b0e5 (diff)
drm/i915/gvt: Release gvt->lock at the failure of finding page track
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>
-rw-r--r--drivers/gpu/drm/i915/gvt/page_track.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/gvt/page_track.c b/drivers/gpu/drm/i915/gvt/page_track.c
index 09bd56e39ec6..2d030545356b 100644
--- 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 intel_vgpu *vgpu, u64 gpa,
165 165
166 page_track = intel_vgpu_find_page_track(vgpu, gpa >> PAGE_SHIFT); 166 page_track = intel_vgpu_find_page_track(vgpu, gpa >> PAGE_SHIFT);
167 if (!page_track) 167 if (!page_track)
168 return 0; 168 goto out;
169 169
170 if (unlikely(vgpu->failsafe)) { 170 if (unlikely(vgpu->failsafe)) {
171 /* Remove write protection to prevent furture traps. */ 171 /* Remove write protection to prevent furture traps. */
@@ -176,6 +176,7 @@ int intel_vgpu_page_track_handler(struct intel_vgpu *vgpu, u64 gpa,
176 gvt_err("guest page write error, gpa %llx\n", gpa); 176 gvt_err("guest page write error, gpa %llx\n", gpa);
177 } 177 }
178 178
179out:
179 mutex_unlock(&gvt->lock); 180 mutex_unlock(&gvt->lock);
180 return ret; 181 return ret;
181} 182}