[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: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mode |
Date: |
Thu, 4 Feb 2016 13:24:33 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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.
Kevin