From: Jason Wang <jasowang@redhat.com>
To: Don Koch <dkoch@verizon.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org, Anthony Liguori <aliguori@amazon.com>,
qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio: validate the existence of handle_output before calling it
Date: Sun, 15 Feb 2015 02:40:55 +0008 [thread overview]
Message-ID: <1423967575.10674.0@smtp.corp.redhat.com> (raw)
In-Reply-To: <20150213151827.1ab64371b8f342c7e806c7d1@verizon.com>
On Sat, Feb 14, 2015 at 4:18 AM, Don Koch <dkoch@verizon.com> wrote:
> On Thu, 12 Feb 2015 11:05:17 +0800
> Jason Wang <jasowang@redhat.com> 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: 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;
>> + }
>
> 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
>>
>>
next prev parent reply other threads:[~2015-02-15 2:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2015-02-13 20:50 ` Paolo Bonzini
2015-02-15 2:35 ` Jason Wang
2015-02-16 9:29 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1423967575.10674.0@smtp.corp.redhat.com \
--to=jasowang@redhat.com \
--cc=aliguori@amazon.com \
--cc=dkoch@verizon.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).