projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0210a8d
)
vhost: Use vhost_get_used_size() in vhost_vring_set_addr()
author
Greg Kurz
<groug@kaod.org>
Sat, 3 Oct 2020 10:02:03 +0000
(12:02 +0200)
committer
Michael S. Tsirkin
<mst@redhat.com>
Sun, 4 Oct 2020 07:44:25 +0000
(
03:44
-0400)
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:
8ea8cf89e19a
("vhost: support event index")
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kurz <groug@kaod.org>
Link:
https://lore.kernel.org/r/160171932300.284610.11846106312938909461.stgit@bahia.lan
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vhost.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/vhost/vhost.c
b/drivers/vhost/vhost.c
index c3b49975dc2821bf636657083922ea466221bbf5..9d2c225fb518b4b528737149507b52c575fd4b23 100644
(file)
--- a/
drivers/vhost/vhost.c
+++ b/
drivers/vhost/vhost.c
@@
-1519,8
+1519,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;
}