Skip to content

Commit ca50ec3

Browse files
eaugermstsirkin
authored andcommitted
vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE
Commit e2ae38c ("vhost: fix hung thread due to erroneous iotlb entries") Forbade vhost iotlb msg with null size to prevent entries with size = start = 0 and last = ULONG_MAX to end up in the iotlb. Then commit 95932ab ("vhost: allow batching hint without size") only applied the check for VHOST_IOTLB_UPDATE and VHOST_IOTLB_INVALIDATE message types to fix a regression observed with batching hit. Still, the introduction of that check introduced a regression for some users attempting to invalidate the whole ULONG_MAX range by setting the size to 0. This is the case with qemu/smmuv3/vhost integration which does not work anymore. It Looks safe to partially revert the original commit and allow VHOST_IOTLB_INVALIDATE messages with null size. vhost_iotlb_del_range() will compute a correct end iova. Same for vhost_vdpa_iotlb_unmap(). Signed-off-by: Eric Auger <[email protected]> Fixes: e2ae38c ("vhost: fix hung thread due to erroneous iotlb entries") Cc: [email protected] # v5.17+ Acked-by: Jason Wang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent abb0dcf commit ca50ec3

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/vhost/vhost.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,9 +1458,7 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev,
14581458
goto done;
14591459
}
14601460

1461-
if ((msg.type == VHOST_IOTLB_UPDATE ||
1462-
msg.type == VHOST_IOTLB_INVALIDATE) &&
1463-
msg.size == 0) {
1461+
if (msg.type == VHOST_IOTLB_UPDATE && msg.size == 0) {
14641462
ret = -EINVAL;
14651463
goto done;
14661464
}

0 commit comments

Comments
 (0)