From nobody Fri May 3 19:58:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585226414; cv=none; d=zohomail.com; s=zohoarc; b=EoPM5ZsqnSxar0Fw0lN7R+xeo7jIH35xjTRbkIzzOOVGrh4lUhENIAufKhZ0UvBj5rhp2yAi3WLqGPfjdyXL+JWLzSC/lPaaRlny0YGyO5mbsAKYb3jG1T3A/8xEXSIc/T+6QZ6UvBjKG+KRiK1OjhtoPeBdaeV4rXN13Z/qpvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585226414; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4oxHhwqDCAITgqKNd5ZvYeP4BGO4iNz67H5HnAbEbjM=; b=EFqIqUh/xmC3VP1i7WACAHkr0FDtkUEtcnCSzKuEVvXsWAK5iybyNVEyuAtVqRSCsOBCn3BvcAPrcLuzUPyy2q5Y3joXqW9/IF5dHSowKASnZbWSttdaChrV71TkpgSo5E3rDKS0WMw9dt/vGXbJxgvODFztzBmkGrbHQs5qIS0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585226414310729.5790191003657; Thu, 26 Mar 2020 05:40:14 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-287-TGcSOVsHMjKKZWj7bNjOKg-1; Thu, 26 Mar 2020 08:40:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FE2A800D5C; Thu, 26 Mar 2020 12:40:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6805C97AE5; Thu, 26 Mar 2020 12:39:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9CFEA1832DBB; Thu, 26 Mar 2020 12:39:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02QCdpEj022967 for ; Thu, 26 Mar 2020 08:39:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id B777D165F7; Thu, 26 Mar 2020 12:39:51 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D78D3B3 for ; Thu, 26 Mar 2020 12:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585226413; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4oxHhwqDCAITgqKNd5ZvYeP4BGO4iNz67H5HnAbEbjM=; b=B9yhZm6UXsyj7lkFnnj4ep526MqH7rDF0U7yuBaGfyWCbH5DRKIEJgN+epEqlvA7l89yk2 nLx6+FDkmLlSi6beOQigq1y7ZywcSB4JGPOlQlm7Y5Zhxu1gHHY1e74KRlSwtSHwrH+sDH 1ygjp/jTS+Ivf5qKtKUb/x7UUF4txBY= X-MC-Unique: TGcSOVsHMjKKZWj7bNjOKg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/3] qemu: migration: Don't use return value of qemuBlockJobUpdate Date: Thu, 26 Mar 2020 13:39:39 +0100 Message-Id: <1a84a2cedcac56f3b15d5511d86c7a96c2c821c4.1585226343.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Upcoming patch will remove it. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik Reviewed-by: Pavel Mores --- src/qemu/qemu_migration.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 8a1801d408..bc280e856a 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -510,7 +510,6 @@ qemuMigrationSrcNBDStorageCopyReady(virDomainObjPtr vm, { size_t i; size_t notReady =3D 0; - int status; for (i =3D 0; i < vm->def->ndisks; i++) { virDomainDiskDefPtr disk =3D vm->def->disks[i]; @@ -526,8 +525,8 @@ qemuMigrationSrcNBDStorageCopyReady(virDomainObjPtr vm, return -1; } - status =3D qemuBlockJobUpdate(vm, job, asyncJob); - if (status =3D=3D VIR_DOMAIN_BLOCK_JOB_FAILED) { + qemuBlockJobUpdate(vm, job, asyncJob); + if (job->state =3D=3D VIR_DOMAIN_BLOCK_JOB_FAILED) { qemuMigrationNBDReportMirrorError(job, disk->dst); virObjectUnref(job); return -1; @@ -567,7 +566,6 @@ qemuMigrationSrcNBDCopyCancelled(virDomainObjPtr vm, size_t i; size_t active =3D 0; size_t completed =3D 0; - int status; bool failed =3D false; retry: @@ -582,8 +580,8 @@ qemuMigrationSrcNBDCopyCancelled(virDomainObjPtr vm, if (!(job =3D qemuBlockJobDiskGetJob(disk))) continue; - status =3D qemuBlockJobUpdate(vm, job, asyncJob); - switch (status) { + qemuBlockJobUpdate(vm, job, asyncJob); + switch (job->state) { case VIR_DOMAIN_BLOCK_JOB_FAILED: if (check) { qemuMigrationNBDReportMirrorError(job, disk->dst); @@ -599,7 +597,7 @@ qemuMigrationSrcNBDCopyCancelled(virDomainObjPtr vm, active++; } - if (status =3D=3D VIR_DOMAIN_BLOCK_JOB_COMPLETED) + if (job->state =3D=3D VIR_DOMAIN_BLOCK_JOB_COMPLETED) completed++; virObjectUnref(job); @@ -650,11 +648,10 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriverPtr dri= ver, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - int status; int rv; - status =3D qemuBlockJobUpdate(vm, job, asyncJob); - switch (status) { + qemuBlockJobUpdate(vm, job, asyncJob); + switch (job->state) { case VIR_DOMAIN_BLOCK_JOB_FAILED: case VIR_DOMAIN_BLOCK_JOB_CANCELED: if (failNoJob) { --=20 2.24.1 From nobody Fri May 3 19:58:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585226411; cv=none; d=zohomail.com; s=zohoarc; b=DJCao4mg/WO+F+tB5D6m3fwo+t7baxhVzd7Yk1ikmkj1CZgmLDb1X8EiuemY/YVJ1T5KlH5PUgbFDcs+21ipzhaIcTWIs/gkEDwclhbnsFIJs7cXEZssP7/N6jMYEDXQwUfxRAvpyYg9eTx0iG9szswtGNGU4/jg72THlSFy1ck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585226411; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ywqwoOrJ4FzApWQv0ZhTX9fO9qctqUIsbIG7Y1lE2KQ=; b=GMw5dhVnMnOHUlAy6f9AgCHh3uqZL8u6XJjgHkGvBtvYGiKqMvio9L3WDLVoGaMxG/ab6YXekTdMckTGr39YSCrXzsRxFwjqMliznhnuKe08Ppp/CL+792Mq1FVxXveIRcnhXipn74CtVe69P1XI/q0ddS+1lCzm+MfwqzEh69M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585226411161762.496483222074; Thu, 26 Mar 2020 05:40:11 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-86-UNEosI6IMEqIHvY38QiqvQ-1; Thu, 26 Mar 2020 08:40:07 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3C4D107ACCA; Thu, 26 Mar 2020 12:40:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF5B7D767F; Thu, 26 Mar 2020 12:39:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E2F501832DAB; Thu, 26 Mar 2020 12:39:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02QCdq52022972 for ; Thu, 26 Mar 2020 08:39:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8DA6719C70; Thu, 26 Mar 2020 12:39:52 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11E873AA for ; Thu, 26 Mar 2020 12:39:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585226409; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ywqwoOrJ4FzApWQv0ZhTX9fO9qctqUIsbIG7Y1lE2KQ=; b=N/36C1z4yFfMauMGQtIa8BV9AYSaWpDCwYXdJbJHxGaJq87emt3J0N+VyiJ1fRdTxgNSYq MVKXMICtqM1vMEJlb25xUaH/Rh+mXY7NF1I/W2L57ieCMEIB6doH7VQ57WgBVKZy2IcNuQ WRnxFxpmG0ZZKk6hk4VBGKkZDWNsWNA= X-MC-Unique: UNEosI6IMEqIHvY38QiqvQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/3] qemuBlockJobUpdate: Remove return value Date: Thu, 26 Mar 2020 13:39:40 +0100 Message-Id: <517f2c36cab96a731962e0fd6cc185a99a550603.1585226343.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" No callers use it any more. Additionally if qemuBlockJobUpdate was called with the last reference of the job e.g. in qemuBlockJobRefreshJobs, the reading of the job state would happen from freed memory. Reported-by: Pavel Mores Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik Reviewed-by: Pavel Mores --- src/qemu/qemu_blockjob.c | 8 ++------ src/qemu/qemu_blockjob.h | 7 ++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 21a043d369..6576f8721f 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1658,10 +1658,8 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver, * * Update disk's mirror state in response to a block job event stored in * blockJobStatus by qemuProcessHandleBlockJob event handler. - * - * Returns the block job event processed or -1 if there was no pending eve= nt. */ -int +void qemuBlockJobUpdate(virDomainObjPtr vm, qemuBlockJobDataPtr job, int asyncJob) @@ -1669,14 +1667,12 @@ qemuBlockJobUpdate(virDomainObjPtr vm, qemuDomainObjPrivatePtr priv =3D vm->privateData; if (job->newstate =3D=3D -1) - return -1; + return; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) qemuBlockJobEventProcess(priv->driver, vm, job, asyncJob); else qemuBlockJobEventProcessLegacy(priv->driver, vm, job, asyncJob); - - return job->state; } diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 9264c70217..19498b5bd8 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -232,9 +232,10 @@ int qemuBlockJobRefreshJobs(virQEMUDriverPtr driver, virDomainObjPtr vm); -int qemuBlockJobUpdate(virDomainObjPtr vm, - qemuBlockJobDataPtr job, - int asyncJob); +void +qemuBlockJobUpdate(virDomainObjPtr vm, + qemuBlockJobDataPtr job, + int asyncJob); void qemuBlockJobSyncBegin(qemuBlockJobDataPtr job); void qemuBlockJobSyncEnd(virDomainObjPtr vm, --=20 2.24.1 From nobody Fri May 3 19:58:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585226415; cv=none; d=zohomail.com; s=zohoarc; b=Gza9WyOYnmHLInhBMQguQkRCHN1kLbmJZmgwK3NgsTq1HA7OrzVEpwgZ2blWUd5skZBAhibxDQEi2/Ug3u0tt94RujCj8tT13HjzNPFeDyuADD5r9nWnio3mbE81TuNH6jAm/sXDQoZ74N7G4mLBNatQYzT7x36z9fa4JrwxgP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585226415; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XeEpqNQOp2RpCrL/Xq+k7zMz2t5PH7+5PHBxTQnDMOg=; b=MaQKI6rm7rjU4CObI7Xki4BDfwj7pcgUYUl0MIPb1UPp0aL+oEcw7Oqqi8U/ehpGSCbgTq44n8+PH2niq+hpE0Lw0D0Zbc5Id2fYsPcn043M+lUdPPMAmw90kCKhwjlLjxXwExGuihTcNufp2HdrrY33cyRHHj1oy03uCwIV7cM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585226415339794.1459633992297; Thu, 26 Mar 2020 05:40:15 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-105-UBsCvOInMgmB9d0afNE3cA-1; Thu, 26 Mar 2020 08:40:11 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9467108839B; Thu, 26 Mar 2020 12:40:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8129CD7697; Thu, 26 Mar 2020 12:40:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3E2741832DAB; Thu, 26 Mar 2020 12:40:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02QCdveq022988 for ; Thu, 26 Mar 2020 08:39:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id D900C3A9; Thu, 26 Mar 2020 12:39:57 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57445396 for ; Thu, 26 Mar 2020 12:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585226414; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XeEpqNQOp2RpCrL/Xq+k7zMz2t5PH7+5PHBxTQnDMOg=; b=JY9xPNSCfq1Dq9PA4a/PmUOcAA5+h5uJ8HEGEukul1o17WKfR4ie7NJ3tfrRibQ+ZWGAvu pL9wxCKlVQAKz4a/lTy3zsMb0UA5COypXdfRJPqrjVekQYyup6XGDdWjcU3gJixD5DzMGF qogVAKSBAHmfCn3N4cofWNVXxmYCIpE= X-MC-Unique: UBsCvOInMgmB9d0afNE3cA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/3] qemuBlockJobRefreshJobs: Warn readers that 'job' may be invalid after update Date: Thu, 26 Mar 2020 13:39:41 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a comment noting that job update can cause the pointer to be invalid and thus should not be accessed after. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik Reviewed-by: Pavel Mores --- src/qemu/qemu_blockjob.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 6576f8721f..2032c0c1c5 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -571,6 +571,7 @@ qemuBlockJobRefreshJobs(virQEMUDriverPtr driver, if (job->newstate !=3D -1) qemuBlockJobUpdate(vm, job, QEMU_ASYNC_JOB_NONE); + /* 'job' may be invalid after this update */ } /* remove data for job which qemu didn't report (the algorithm is --=20 2.24.1