lkml.org 
[lkml]   [2021]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH RFC v2 03/10] vringh: reset kiov 'consumed' field in __vringh_iov()
From
Date

On 2021/1/28 下午10:41, Stefano Garzarella wrote:
> __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.
>
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>


I had a question(I remember we had some discussion like this but I
forget the conclusion):

I see e.g in vringh_getdesc_kern() it has the following comment:

/*
 * Note that you may need to clean up riov and wiov, even on error!
 */

So it looks to me the correct way is to call vringh_kiov_cleanup() before?

Thanks


> ---
> drivers/vhost/vringh.c | 4 ++--
> 1 file 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;

\
 
 \ /
  Last update: 2021-02-01 07:48    [W:0.291 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site