Skip to content

Commit 71878fa

Browse files
gkurzmstsirkin
authored andcommitted
vhost: Use vhost_get_used_size() in vhost_vring_set_addr()
The open-coded computation of the used size doesn't take the event into account when the VIRTIO_RING_F_EVENT_IDX feature is present. Fix that by using vhost_get_used_size(). Fixes: 8ea8cf8 ("vhost: support event index") Cc: [email protected] Signed-off-by: Greg Kurz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 0210a8d commit 71878fa

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/vhost/vhost.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,8 +1519,7 @@ static long vhost_vring_set_addr(struct vhost_dev *d,
15191519
/* Also validate log access for used ring if enabled. */
15201520
if ((a.flags & (0x1 << VHOST_VRING_F_LOG)) &&
15211521
!log_access_ok(vq->log_base, a.log_guest_addr,
1522-
sizeof *vq->used +
1523-
vq->num * sizeof *vq->used->ring))
1522+
vhost_get_used_size(vq, vq->num)))
15241523
return -EINVAL;
15251524
}
15261525

0 commit comments

Comments
 (0)