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 <[email protected]>
Signed-off-by: Stefano Garzarella <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Michael S. Tsirkin <[email protected]>
  • Loading branch information
stefano-garzarella authored and mstsirkin 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.