summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChanglong Xie <xiecl.fnst@cn.fujitsu.com>2016-02-05 10:25:22 +0800
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:45:30 -0600
commitfdf3e4bc98c26064f8abc9b5cde599f81544c50e (patch)
treee36d4efe378080049596fd1ee10e49b510477799
parent146d39904751bc35d9a7b34d8dd36d8336a10f1c (diff)
downloadhqemu-fdf3e4bc98c26064f8abc9b5cde599f81544c50e.zip
hqemu-fdf3e4bc98c26064f8abc9b5cde599f81544c50e.tar.gz
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>
-rw-r--r--block/quorum.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/quorum.c b/block/quorum.c
index a5ae4b8..11cc60b 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;
}
OpenPOWER on IntegriCloud