diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2021-03-15 17:34:39 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-05-03 04:55:53 -0400 |
commit | bbc2c372a83d74d5499ad21d0ade2b71f5bde620 (patch) | |
tree | fbd50a66ee0c0e155dc7a490ae41b6a66cffff6a /drivers/vhost | |
parent | f53d9910d009bc015b42d88114e2d86a93b0e6b7 (diff) | |
download | linux-bbc2c372a83d74d5499ad21d0ade2b71f5bde620.tar.gz linux-bbc2c372a83d74d5499ad21d0ade2b71f5bde620.tar.bz2 linux-bbc2c372a83d74d5499ad21d0ade2b71f5bde620.zip |
vringh: reset kiov 'consumed' field in __vringh_iov()
__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>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vringh.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index f68122705719..bee63d68201a 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c @@ -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; |