mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
vhost: Use vhost_get_used_size() in vhost_vring_set_addr()
commit 71878fa46c7e3b40fa7b3f1b6e4ba3f92f1ac359 upstream.
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: 8ea8cf89e1 ("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]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
57b47abc1a
commit
920a61ddd3
1 changed files with 1 additions and 2 deletions
|
|
@ -1545,8 +1545,7 @@ static long vhost_vring_set_addr(struct vhost_dev *d,
|
|||
/* Also validate log access for used ring if enabled. */
|
||||
if ((a.flags & (0x1 << VHOST_VRING_F_LOG)) &&
|
||||
!log_access_ok(vq->log_base, a.log_guest_addr,
|
||||
sizeof *vq->used +
|
||||
vq->num * sizeof *vq->used->ring))
|
||||
vhost_get_used_size(vq, vq->num)))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue