qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] virtio: validate the existence of handle_output


From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH] virtio: validate the existence of handle_output before calling it
Date: Sun, 15 Feb 2015 02:40:55 +0008



On Sat, Feb 14, 2015 at 4:18 AM, Don Koch <address@hidden> wrote:
On Thu, 12 Feb 2015 11:05:17 +0800
Jason Wang <address@hidden> wrote:

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: address@hidden
 Cc: Anthony Liguori <address@hidden>
 Cc: Michael S. Tsirkin <address@hidden>
 Signed-off-by: Jason Wang <address@hidden>
 ---
  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;
 +        }

Maybe better to just change line 762 to:
     if (vq->vring.desc && vq->handle_output) {

-d

Yes, better.


          trace_virtio_queue_notify(vdev, vq - vdev->vq, vq);
          vq->handle_output(vdev, vq);
      }
-- 1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]