]>
Commit | Line | Data |
---|---|---|
415bbd25 GKH |
1 | From 3438b2c039b4bf26881786a1f3450f016d66ad11 Mon Sep 17 00:00:00 2001 |
2 | From: Halil Pasic <pasic@linux.ibm.com> | |
3 | Date: Mon, 21 Jan 2019 13:19:43 +0100 | |
4 | Subject: s390/virtio: handle find on invalid queue gracefully | |
5 | ||
6 | From: Halil Pasic <pasic@linux.ibm.com> | |
7 | ||
8 | commit 3438b2c039b4bf26881786a1f3450f016d66ad11 upstream. | |
9 | ||
10 | A queue with a capacity of zero is clearly not a valid virtio queue. | |
11 | Some emulators report zero queue size if queried with an invalid queue | |
12 | index. Instead of crashing in this case let us just return -ENOENT. To | |
13 | make that work properly, let us fix the notifier cleanup logic as well. | |
14 | ||
15 | Cc: stable@vger.kernel.org | |
16 | Signed-off-by: Halil Pasic <pasic@linux.ibm.com> | |
17 | Signed-off-by: Cornelia Huck <cohuck@redhat.com> | |
18 | Signed-off-by: Michael S. Tsirkin <mst@redhat.com> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | ||
21 | --- | |
22 | drivers/s390/virtio/virtio_ccw.c | 4 +++- | |
23 | 1 file changed, 3 insertions(+), 1 deletion(-) | |
24 | ||
25 | --- a/drivers/s390/virtio/virtio_ccw.c | |
26 | +++ b/drivers/s390/virtio/virtio_ccw.c | |
27 | @@ -272,6 +272,8 @@ static void virtio_ccw_drop_indicators(s | |
28 | { | |
29 | struct virtio_ccw_vq_info *info; | |
30 | ||
31 | + if (!vcdev->airq_info) | |
32 | + return; | |
33 | list_for_each_entry(info, &vcdev->virtqueues, node) | |
34 | drop_airq_indicator(info->vq, vcdev->airq_info); | |
35 | } | |
36 | @@ -413,7 +415,7 @@ static int virtio_ccw_read_vq_conf(struc | |
37 | ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_READ_VQ_CONF); | |
38 | if (ret) | |
39 | return ret; | |
40 | - return vcdev->config_block->num; | |
41 | + return vcdev->config_block->num ?: -ENOENT; | |
42 | } | |
43 | ||
44 | static void virtio_ccw_del_vq(struct virtqueue *vq, struct ccw1 *ccw) |