Skip to content

Commit 1477c8a

Browse files
siwliu-kernelmstsirkin
authored andcommitted
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: 4c8cf31 ("vhost: introduce vDPA-based backend") Signed-off-by: Si-Wei Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent ab51225 commit 1477c8a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/vhost/vdpa.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ static int vhost_vdpa_map(struct vhost_vdpa *v,
565565
perm_to_iommu_flags(perm));
566566
}
567567

568+
if (r)
569+
vhost_iotlb_del_range(dev->iotlb, iova, iova + size - 1);
570+
568571
return r;
569572
}
570573

0 commit comments

Comments
 (0)