Skip to content

Commit 03a91c9

Browse files
anirudhrbmstsirkin
authored andcommitted
vhost: handle error while adding split ranges to iotlb
vhost_iotlb_add_range_ctx() handles the range [0, ULONG_MAX] by splitting it into two ranges and adding them separately. The return value of adding the first range to the iotlb is currently ignored. Check the return value and bail out in case of an error. Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com> Link: https://lore.kernel.org/r/20220312141121.4981-1-mail@anirudhrb.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Fixes: e2ae38c ("vhost: fix hung thread due to erroneous iotlb entries") Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
1 parent b04d910 commit 03a91c9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/vhost/iotlb.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,12 @@ int vhost_iotlb_add_range_ctx(struct vhost_iotlb *iotlb,
6262
*/
6363
if (start == 0 && last == ULONG_MAX) {
6464
u64 mid = last / 2;
65+
int err = vhost_iotlb_add_range_ctx(iotlb, start, mid, addr,
66+
perm, opaque);
67+
68+
if (err)
69+
return err;
6570

66-
vhost_iotlb_add_range_ctx(iotlb, start, mid, addr, perm, opaque);
6771
addr += mid + 1;
6872
start = mid + 1;
6973
}

0 commit comments

Comments
 (0)