From ded07c48e26d7bdf315b75db482bc03cec4a6464 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 17 May 2017 13:09:15 +0200 Subject: [PATCH 09/27] curl: strengthen assertion in curl_clean_state RH-Author: Paolo Bonzini Message-id: <20170517130921.27402-2-pbonzini@redhat.com> Patchwork-id: 75265 O-Subject: [RHEL7.4 qemu-kvm PATCH v2 1/7] curl: strengthen assertion in curl_clean_state Bugzilla: 1437393 RH-Acked-by: Max Reitz RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Jeffrey Cody curl_clean_state should only be called after all AIOCBs have been completed. This is not so obvious for the call from curl_detach_aio_context, so assert that. Cc: qemu-stable@nongnu.org Reviewed-by: Jeff Cody Signed-off-by: Paolo Bonzini Reviewed-by: Max Reitz Message-id: 20170515100059.15795-2-pbonzini@redhat.com Signed-off-by: Jeff Cody (cherry picked from commit 675a775633e68bf8b426a896fea5b93a4f4ff1cc) Signed-off-by: Miroslav Rezanina --- block/curl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/curl.c b/block/curl.c index 2708d57..e77a64b 100644 --- a/block/curl.c +++ b/block/curl.c @@ -532,6 +532,11 @@ static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s) static void curl_clean_state(CURLState *s) { + int j; + for (j = 0; j < CURL_NUM_ACB; j++) { + assert(!s->acb[j]); + } + if (s->s->multi) curl_multi_remove_handle(s->s->multi, s->curl); -- 1.8.3.1