android_kernel_oneplus_msm8998/drivers/s390
Halil Pasic e32c7473a4 virtio/s390: fix race in ccw_io_helper()
commit 78b1a52e05c9db11d293342e8d6d8a230a04b4e7 upstream.

While ccw_io_helper() seems like intended to be exclusive in a sense that
it is supposed to facilitate I/O for at most one thread at any given
time, there is actually nothing ensuring that threads won't pile up at
vcdev->wait_q. If they do, all threads get woken up and see the status
that belongs to some other request than their own. This can lead to bugs.
For an example see:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1788432

This race normally does not cause any problems. The operations provided
by struct virtio_config_ops are usually invoked in a well defined
sequence, normally don't fail, and are normally used quite infrequent
too.

Yet, if some of the these operations are directly triggered via sysfs
attributes, like in the case described by the referenced bug, userspace
is given an opportunity to force races by increasing the frequency of the
given operations.

Let us fix the problem by ensuring, that for each device, we finish
processing the previous request before starting with a new one.

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Reported-by: Colin Ian King <colin.king@canonical.com>
Cc: stable@vger.kernel.org
Message-Id: <20180925121309.58524-3-pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-13 09:21:36 +01:00
..
block s390/dasd: fix hanging offline processing due to canceled worker 2018-09-15 09:40:39 +02:00
char s390: introduce execute-trampolines for branches 2018-04-29 07:50:03 +02:00
cio s390/qdio: reset old sbal_state flags 2018-09-05 09:18:40 +02:00
crypto s390/zcrypt: Introduce CEX6 toleration 2017-03-30 09:35:20 +02:00
net s390/qeth: fix length check in SNMP processing 2018-12-13 09:21:26 +01:00
scsi scsi: zfcp: fix missing REC trigger trace on enqueue without ERP thread 2018-07-03 11:21:31 +02:00
virtio virtio/s390: fix race in ccw_io_helper() 2018-12-13 09:21:36 +01:00
Makefile virtio/s390: rename drivers/s390/kvm -> drivers/s390/virtio 2015-07-07 14:27:06 +03:00