[Top][All Lists]

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

Re: [Qemu-devel] [PATCH V2 1/3] virtio: guard against NULL pfn

From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH V2 1/3] virtio: guard against NULL pfn
Date: Tue, 14 Mar 2017 10:37:00 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

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 <address@hidden> 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 <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
  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
Yes, and the check should also go first (before the function can return 0).


Yes, will fix in V3.


reply via email to

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