drm/i915/gvt: Release gvt->lock at the failure of finding page track
authorXiong Zhang <xiong.y.zhang@intel.com>
Mon, 5 Mar 2018 22:07:27 +0000 (06:07 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Tue, 6 Mar 2018 06:49:24 +0000 (14:49 +0800)
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>
drivers/gpu/drm/i915/gvt/page_track.c

index 09bd56e39ec6162fc91038e8bacd7e71f289043c..2d030545356b752e5845454a3c07e98a113d5da8 100644 (file)
@@ -165,7 +165,7 @@ int intel_vgpu_page_track_handler(struct intel_vgpu *vgpu, u64 gpa,
 
        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 intel_vgpu *vgpu, u64 gpa,
                        gvt_err("guest page write error, gpa %llx\n", gpa);
        }
 
+out:
        mutex_unlock(&gvt->lock);
        return ret;
 }