浏览代码

vfio iommu type1: WARN_ON if notifier block is not unregistered

mdev vendor driver should unregister the iommu notifier since the vfio
iommu can persist beyond the attachment of the mdev group. WARN_ON will
show warning if vendor driver doesn't unregister the notifier and is
forced to follow the implementations steps.

Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Signed-off-by: Neo Jia <cjia@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Kirti Wankhede 9 年之前
父节点
当前提交
3cedd7d75f
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/vfio/vfio_iommu_type1.c

+ 2 - 0
drivers/vfio/vfio_iommu_type1.c

@@ -1361,6 +1361,8 @@ static void vfio_sanity_check_pfn_list(struct vfio_iommu *iommu)
 		if (WARN_ON(!RB_EMPTY_ROOT(&dma->pfn_list)))
 		if (WARN_ON(!RB_EMPTY_ROOT(&dma->pfn_list)))
 			break;
 			break;
 	}
 	}
+	/* mdev vendor driver must unregister notifier */
+	WARN_ON(iommu->notifier.head);
 }
 }
 
 
 static void vfio_iommu_type1_detach_group(void *iommu_data,
 static void vfio_iommu_type1_detach_group(void *iommu_data,