|
|
9ae3a8 |
From 612017cc4834cd5eabc12afc7dd6cebf890b42e5 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Xiao Wang <jasowang@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 19 Aug 2016 09:24:25 +0200
|
|
|
9ae3a8 |
Subject: [PATCH] virtio: validate the existence of handle_output before
|
|
|
9ae3a8 |
calling it
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Xiao Wang <jasowang@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1471598665-23846-1-git-send-email-jasowang@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 72021
|
|
|
9ae3a8 |
O-Subject: [RHEL7.3 qemu-kvm PATCH] virtio: validate the existence of handle_output before calling it
|
|
|
9ae3a8 |
Bugzilla: 1367040
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Pankaj Gupta <pagupta@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1367040
|
|
|
9ae3a8 |
Brew Build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=11620539
|
|
|
9ae3a8 |
Test status: Tested by myself.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
We don't validate the existence of handle_output which may let a buggy
|
|
|
9ae3a8 |
guest to trigger a SIGSEV easily. E.g:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
1) write 10 to queue_sel to a virtio net device with only 1 queue
|
|
|
9ae3a8 |
2) setup an arbitrary pfn
|
|
|
9ae3a8 |
3) then notify queue 10
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Fixing this by validating the existence of handle_output before.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Cc: qemu-stable@nongnu.org
|
|
|
9ae3a8 |
Cc: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Don Koch <dkoch@verizon.com>
|
|
|
9ae3a8 |
Reviewed-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 9e0f5b8108e248b78444c9a2ec41a8309825736c)
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/virtio/virtio.c | 3 ++-
|
|
|
9ae3a8 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
|
|
|
9ae3a8 |
index a861870..e67337b 100644
|
|
|
9ae3a8 |
--- a/hw/virtio/virtio.c
|
|
|
9ae3a8 |
+++ b/hw/virtio/virtio.c
|
|
|
9ae3a8 |
@@ -692,8 +692,9 @@ int virtio_queue_get_id(VirtQueue *vq)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
void virtio_queue_notify_vq(VirtQueue *vq)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- if (vq->vring.desc) {
|
|
|
9ae3a8 |
+ if (vq->vring.desc && vq->handle_output) {
|
|
|
9ae3a8 |
VirtIODevice *vdev = vq->vdev;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
trace_virtio_queue_notify(vdev, vq - vdev->vq, vq);
|
|
|
9ae3a8 |
vq->handle_output(vdev, vq);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|