From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLk5p-0002A2-Qu for qemu-devel@nongnu.org; Wed, 11 Feb 2015 22:05:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLk5l-00018v-HB for qemu-devel@nongnu.org; Wed, 11 Feb 2015 22:05:29 -0500 From: Jason Wang Date: Thu, 12 Feb 2015 11:05:17 +0800 Message-Id: <1423710317-15832-1-git-send-email-jasowang@redhat.com> Subject: [Qemu-devel] [PATCH] virtio: validate the existence of handle_output before calling it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jason Wang , qemu-stable@nongnu.org, 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 Cc: Michael S. Tsirkin Signed-off-by: Jason Wang --- 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