linux-stable/drivers/vhost
Halil Pasic cda8bba0f9 vhost: fix initialization for vq->is_le
Currently, under certain circumstances vhost_init_is_le does just a part
of the initialization job, and depends on vhost_reset_is_le being called
too. For this reason vhost_vq_init_access used to call vhost_reset_is_le
when vq->private_data is NULL. This is not only counter intuitive, but
also real a problem because it breaks vhost_net. The bug was introduced to
vhost_net with commit 2751c9882b ("vhost: cross-endian support for
legacy devices"). The symptom is corruption of the vq's used.idx field
(virtio) after VHOST_NET_SET_BACKEND was issued as a part of the vhost
shutdown on a vq with pending descriptors.

Let us make sure the outcome of vhost_init_is_le never depend on the state
it is actually supposed to initialize, and fix virtio_net by removing the
reset from vhost_vq_init_access.

With the above, there is no reason for vhost_reset_is_le to do just half
of the job. Let us make vhost_reset_is_le reinitialize is_le.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reported-by: Michael A. Tebolt <miket@us.ibm.com>
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Fixes: commit 2751c9882b ("vhost: cross-endian support for legacy devices")
Cc: <stable@vger.kernel.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Tested-by: Michael A. Tebolt <miket@us.ibm.com>
2017-02-03 23:38:57 +02:00
..
Kconfig vhost: split out vringh Kconfig 2016-08-02 16:54:28 +03:00
Kconfig.vringh vhost: split out vringh Kconfig 2016-08-02 16:54:28 +03:00
Makefile VSOCK: Add Makefile and Kconfig 2016-08-02 02:57:30 +03:00
net.c locking/core: Remove cpu_relax_lowlatency() users 2016-11-16 10:15:10 +01:00
scsi.c vhost/scsi: silence uninitialized variable warning 2017-01-19 23:46:30 +02:00
test.c Merge 4.8-rc5 into char-misc-next 2016-09-05 08:04:07 +02:00
test.h vhost test module 2010-12-09 16:00:21 +02:00
vhost.c vhost: fix initialization for vq->is_le 2017-02-03 23:38:57 +02:00
vhost.h vhost: cache used event for better performance 2016-12-16 00:12:50 +02:00
vringh.c vringh: kill off ACCESS_ONCE() 2016-12-16 00:13:36 +02:00
vsock.c vhost/vsock: handle vhost_vq_init_access() error 2017-01-25 00:33:10 +02:00