qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio: validate the existence of handle_output before calling it
@ 2015-02-12  3:05 Jason Wang
  2015-02-13 20:18 ` Don Koch
  2015-02-13 20:50 ` Paolo Bonzini
  0 siblings, 2 replies; 6+ messages in thread
From: Jason Wang @ 2015-02-12  3:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jason Wang, qemu-stable, Anthony Liguori, Michael S. Tsirkin

We don't validate the existence of handle_output which may let a buggy
guest to trigger a SIGSEV easily. Fix this by validate its existence
before.

Cc: qemu-stable@nongnu.org
Cc: Anthony Liguori <aliguori@amazon.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/virtio/virtio.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index d735343..ffc22e8 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -761,6 +761,10 @@ void virtio_queue_notify_vq(VirtQueue *vq)
 {
     if (vq->vring.desc) {
         VirtIODevice *vdev = vq->vdev;
+
+        if (!vq->handle_output) {
+            return;
+        }
         trace_virtio_queue_notify(vdev, vq - vdev->vq, vq);
         vq->handle_output(vdev, vq);
     }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-16  9:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12  3:05 [Qemu-devel] [PATCH] virtio: validate the existence of handle_output before calling it Jason Wang
2015-02-13 20:18 ` Don Koch
2015-02-15  2:32   ` Jason Wang
2015-02-13 20:50 ` Paolo Bonzini
2015-02-15  2:35   ` Jason Wang
2015-02-16  9:29     ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).