summaryrefslogtreecommitdiff
path: root/drivers/vhost
diff options
context:
space:
mode:
authorSi-Wei Liu <si-wei.liu@oracle.com>2020-10-03 08:02:09 +0300
committerMichael S. Tsirkin <mst@redhat.com>2020-10-04 10:47:02 +0300
commit1477c8aebb94a1db398c12d929a9d27bbd678d8c (patch)
treefcfa8b329f2a0f59089a735083e8e1b86990fb4c /drivers/vhost
parentab5122510b0a453c0ac898ec9952d38e80243ee7 (diff)
downloadlinux-1477c8aebb94a1db398c12d929a9d27bbd678d8c.tar.xz
vhost-vdpa: fix vhost_vdpa_map() on error condition
vhost_vdpa_map() should remove the iotlb entry just added if the corresponding mapping fails to set up properly. Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend") Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> Link: https://lore.kernel.org/r/1601701330-16837-2-git-send-email-si-wei.liu@oracle.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/vdpa.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 9a48439c52e2..02ff5372d5fe 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -565,6 +565,9 @@ static int vhost_vdpa_map(struct vhost_vdpa *v,
perm_to_iommu_flags(perm));
}
+ if (r)
+ vhost_iotlb_del_range(dev->iotlb, iova, iova + size - 1);
+
return r;
}