qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mo


From: Changlong Xie
Subject: Re: [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mode
Date: Fri, 5 Feb 2016 09:57:24 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 02/04/2016 08:24 PM, Kevin Wolf wrote:
Am 04.02.2016 um 11:19 hat Changlong Xie geschrieben:
Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: Changlong Xie <address@hidden>
---
  block/quorum.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/block/quorum.c b/block/quorum.c
index a5ae4b8..0965277 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -295,6 +295,9 @@ static void quorum_aio_cb(void *opaque, int ret)
              quorum_copy_qiov(acb->qiov, &acb->qcrs[acb->child_iter].qiov);
          }
          acb->vote_ret = ret;
+        if (ret < 0) {
+            acb->child_iter--;
+        }
          quorum_aio_finalize(acb);
          return;
      }

This looks semantically correct to me (but I'd like to have an Ack from
Berto), but I would fix it above: We shouldn't do ++acb->child_iter in
the first place if the new value is >= s->num_children. So instead of
decrementing after the fact, just move the increment to inside the then
branch above.

Yes, will fix in next version.

Thanks
        -Xie

Kevin


.






reply via email to

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