qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: mst@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH V2 1/3] virtio: guard against NULL pfn
Date: Tue, 14 Mar 2017 10:37:00 +0800	[thread overview]
Message-ID: <d6c5efef-14a0-370d-86a9-b4882c20066b@redhat.com> (raw)
In-Reply-To: <0178911d-a930-5031-5e9f-4fdedd51fe3e@redhat.com>



On 2017年03月13日 18:18, Paolo Bonzini wrote:
>
> On 13/03/2017 10:55, Cornelia Huck wrote:
>> On Mon, 13 Mar 2017 14:29:41 +0800
>> Jason Wang <jasowang@redhat.com> wrote:
>>
>>> To avoid access stale memory region cache after reset, this patch
>>> check the existence of virtqueue pfn for all exported virtqueue access
>>> helpers before trying to use them.
>>>
>>> Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>>> ---
>>>   hw/virtio/virtio.c | 21 +++++++++++++++++++++
>>>   1 file changed, 21 insertions(+)
>>>
>>> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
>>> index efce4b3..76cc81b 100644
>>> --- a/hw/virtio/virtio.c
>>> +++ b/hw/virtio/virtio.c
>>> @@ -322,6 +322,10 @@ static int virtio_queue_empty_rcu(VirtQueue *vq)
>>>           return 0;
>>>       }
>>>
>>> +    if (unlikely(!vq->vring.avail)) {
>>> +        return 0;
>> Shouldn't that rather return !0 (denoting a non-existing queue as
>> empty)?
> Yes, and the check should also go first (before the function can return 0).
>
> Paolo

Yes, will fix in V3.

Thanks

  reply	other threads:[~2017-03-14  2:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13  6:29 [Qemu-devel] [PATCH V2 1/3] virtio: guard against NULL pfn Jason Wang
2017-03-13  6:29 ` [Qemu-devel] [PATCH V2 2/3] virtio: destroy region cache during reset Jason Wang
2017-03-13 10:05   ` Cornelia Huck
2017-03-13 10:20     ` Paolo Bonzini
2017-03-14  2:14       ` Jason Wang
2017-03-14  2:13     ` Jason Wang
2017-03-13  6:29 ` [Qemu-devel] [PATCH V2 3/3] virtio: validate address space cache during init Jason Wang
2017-03-13 10:15   ` Cornelia Huck
2017-03-13  9:55 ` [Qemu-devel] [PATCH V2 1/3] virtio: guard against NULL pfn Cornelia Huck
2017-03-13 10:18   ` Paolo Bonzini
2017-03-14  2:37     ` Jason Wang [this message]
2017-03-14  2:02   ` Jason Wang

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=d6c5efef-14a0-370d-86a9-b4882c20066b@redhat.com \
    --to=jasowang@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@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).