diff options
author | Changlong Xie <xiecl.fnst@cn.fujitsu.com> | 2016-02-05 10:25:22 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-02-22 09:49:46 +0100 |
commit | f38738e2120851d8378b18a029c4b73e8516b9e0 (patch) | |
tree | 16dfd17fd62f89d888b4e2677209056ebfe37a64 /block | |
parent | 2875645b65865ec2832579557c30b2e8b03dcccd (diff) | |
download | qemu-f38738e2120851d8378b18a029c4b73e8516b9e0.zip |
quorum: fix segfault when read fails in fifo mode
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/quorum.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/quorum.c b/block/quorum.c index a5ae4b812b..11cc60b713 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -286,7 +286,8 @@ static void quorum_aio_cb(void *opaque, int ret) if (acb->is_read && s->read_pattern == QUORUM_READ_PATTERN_FIFO) { /* We try to read next child in FIFO order if we fail to read */ - if (ret < 0 && ++acb->child_iter < s->num_children) { + if (ret < 0 && (acb->child_iter + 1) < s->num_children) { + acb->child_iter++; read_fifo_child(acb); return; } |