Skip to content

Commit

Permalink
vringh: reset kiov 'consumed' field in __vringh_iov()
Browse files Browse the repository at this point in the history
__vringh_iov() overwrites the contents of riov and wiov, in fact it
resets the 'i' and 'used' fields, but also the 'consumed' field should
be reset to avoid an inconsistent state.

Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20210315163450.254396-4-sgarzare@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Stefano Garzarella authored and Michael S. Tsirkin committed May 3, 2021
1 parent f53d991 commit bbc2c37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/vhost/vringh.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ __vringh_iov(struct vringh *vrh, u16 i,
return -EINVAL;

if (riov)
riov->i = riov->used = 0;
riov->i = riov->used = riov->consumed = 0;
if (wiov)
wiov->i = wiov->used = 0;
wiov->i = wiov->used = wiov->consumed = 0;

for (;;) {
void *addr;
Expand Down

0 comments on commit bbc2c37

Please sign in to comment.