Skip to content

Commit

Permalink
vhost-vdpa: fix vhost_vdpa_map() on error condition
Browse files Browse the repository at this point in the history
vhost_vdpa_map() should remove the iotlb entry just added
if the corresponding mapping fails to set up properly.

Fixes: 4c8cf31 ("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>
  • Loading branch information
Si-Wei Liu authored and Michael S. Tsirkin committed Oct 4, 2020
1 parent ab51225 commit 1477c8a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/vhost/vdpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 1477c8a

Please sign in to comment.