vringh: don't use vringh_kiov_advance() in vringh_iov_xfer()
authorStefano Garzarella <sgarzare@redhat.com>
Mon, 25 Sep 2023 10:30:57 +0000 (12:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Oct 2023 20:00:38 +0000 (22:00 +0200)
commit3a72decd6b49ff11a894aabd4d9b3025f046fe61
tree8c1274b6718db765ebaf86e6de5610867a68fca1
parentc12ef025add77ca3a0902e8719d552b6d47b4282
vringh: don't use vringh_kiov_advance() in vringh_iov_xfer()

commit 7aed44babc7f97e82b38e9a68515e699692cc100 upstream.

In the while loop of vringh_iov_xfer(), `partlen` could be 0 if one of
the `iov` has 0 lenght.
In this case, we should skip the iov and go to the next one.
But calling vringh_kiov_advance() with 0 lenght does not cause the
advancement, since it returns immediately if asked to advance by 0 bytes.

Let's restore the code that was there before commit b8c06ad4d67d
("vringh: implement vringh_kiov_advance()"), avoiding using
vringh_kiov_advance().

Fixes: b8c06ad4d67d ("vringh: implement vringh_kiov_advance()")
Cc: stable@vger.kernel.org
Reported-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vhost/vringh.c