From: Liu Yuan Date: Thu, 11 Sep 2014 05:41:21 +0000 (+0800) Subject: quorum: fix quorum_aio_cancel() X-Git-Tag: qemu-xen-4.6.0-rc1~189^2~41 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=997dd8df3e95b2fdbd1f30b3deefaad4e9efd14a;p=qemu-upstream-4.6-testing.git quorum: fix quorum_aio_cancel() For a fifo read pattern, we only have one running aio (possible other cases that has less number than num_children in the future), so we need to check if .acb is NULL against bdrv_aio_cancel() to avoid segfault. Cc: Eric Blake Cc: Benoit Canet Cc: Kevin Wolf Cc: Stefan Hajnoczi Signed-off-by: Liu Yuan Signed-off-by: Fam Zheng Signed-off-by: Stefan Hajnoczi --- diff --git a/block/quorum.c b/block/quorum.c index 093382e8f..41c424954 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -138,7 +138,9 @@ static void quorum_aio_cancel(BlockDriverAIOCB *blockacb) /* cancel all callbacks */ for (i = 0; i < s->num_children; i++) { - bdrv_aio_cancel(acb->qcrs[i].aiocb); + if (acb->qcrs[i].aiocb) { + bdrv_aio_cancel(acb->qcrs[i].aiocb); + } } g_free(acb->qcrs);