Skip to content

Commit 2d66f99

Browse files
jasowangdavem330
authored andcommitted
vhost: correctly check the iova range when waking virtqueue
We don't wakeup the virtqueue if the first byte of pending iova range is the last byte of the range we just got updated. This will lead a virtqueue to wait for IOTLB updating forever. Fixing by correct the check and wake up the virtqueue in this case. Fixes: 6b1e6cc ("vhost: new device IOTLB API") Reported-by: Peter Xu <[email protected]> Signed-off-by: Jason Wang <[email protected]> Reviewed-by: Peter Xu <[email protected]> Tested-by: Peter Xu <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6750c87 commit 2d66f99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/vhost/vhost.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ static void vhost_iotlb_notify_vq(struct vhost_dev *d,
952952
list_for_each_entry_safe(node, n, &d->pending_list, node) {
953953
struct vhost_iotlb_msg *vq_msg = &node->msg.iotlb;
954954
if (msg->iova <= vq_msg->iova &&
955-
msg->iova + msg->size - 1 > vq_msg->iova &&
955+
msg->iova + msg->size - 1 >= vq_msg->iova &&
956956
vq_msg->type == VHOST_IOTLB_MISS) {
957957
vhost_poll_queue(&node->vq->poll);
958958
list_del(&node->node);

0 commit comments

Comments
 (0)