summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorTina Zhang <tina.zhang@intel.com>2017-11-29 09:57:37 +0300
committerZhenyu Wang <zhenyuw@linux.intel.com>2017-12-04 06:24:34 +0300
commit82a3b6701ab1e2cdfb64cf163fc6d1a4576329ff (patch)
treeb4a085b36dcf861983769eb42b05b089607087b0 /drivers/gpu
parent4a136d590bd4c579bb3df154363a3e5b51cb36ce (diff)
downloadlinux-82a3b6701ab1e2cdfb64cf163fc6d1a4576329ff.tar.xz
drm/i915/gvt: Free dmabuf_obj list in intel_vgpu_dmabuf_cleanup
The per vGPU dmabuf_obj list should be released in intel_vgpu_dmabuf_ cleanup, which is invoked either in the process of closing a VM or in the process of removing a vGPU. Fixes: e3a0d7976c53 ("drm/i915/gvt: Handle orphan dmabuf_objs") Signed-off-by: Tina Zhang <tina.zhang@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/gvt/dmabuf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
index 5f39e90f961c..9c40a67ecdd6 100644
--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
+++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
@@ -90,7 +90,7 @@ static void dmabuf_gem_object_free(struct kref *kref)
struct list_head *pos;
struct intel_vgpu_dmabuf_obj *dmabuf_obj;
- if (vgpu) {
+ if (vgpu && vgpu->active && !list_empty(&vgpu->dmabuf_obj_list_head)) {
list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
dmabuf_obj = container_of(pos,
struct intel_vgpu_dmabuf_obj, list);
@@ -530,6 +530,7 @@ void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu)
if (dmabuf_obj->vgpu)
intel_gvt_hypervisor_put_vfio_device(vgpu);
+ list_del(pos);
dmabuf_obj->vgpu = NULL;
}