vfio/iommu_type1: Fix some sanity checks in detach group
authorKeqian Zhu <zhukeqian1@huawei.com>
Fri, 22 Jan 2021 09:26:35 +0000 (17:26 +0800)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 1 Feb 2021 20:40:52 +0000 (13:40 -0700)
commit4a19f37a3dd3f29997735e61b25ddad24b8abe73
treedb83d3789ce5c9d0d69304cf5ebff0f5369a3a69
parentd0a78f91761fcd837da1e7a4b0f8368873adc646
vfio/iommu_type1: Fix some sanity checks in detach group

vfio_sanity_check_pfn_list() is used to check whether pfn_list and
notifier are empty when remove the external domain, so it makes a
wrong assumption that only external domain will use the pinning
interface.

Now we apply the pfn_list check when a vfio_dma is removed and apply
the notifier check when all domains are removed.

Fixes: a54eb55045ae ("vfio iommu type1: Add support for mediated devices")
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c