From nobody Tue Apr 23 09:09:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1592892230; cv=none; d=zohomail.com; s=zohoarc; b=YjcdSsp4keUbwkwi5tZn/bsWBislneA0/vV5j6/sMkt0JvoW/HGOn5Myq3qZv6Pi6kmnS01Nbzdrwn3fnEHIc8jfdlX4ww4/JgoU7Q2rKtpREQWJFgM6PaugacTuVA6457bO1ApHsf8F3FDRQi+2DnuyAgIVBEefvT5JRQQ44B0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592892230; 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=+OuoWBEh7wmymvRSFt3dzyRs4NqHckJznyf5wRBMQxk=; b=FKM1XjVOIHAsgxVc4EajOnpds9TrbXNvkqNkOkPGTCUEflOsp7pvsoco6fgi0K+UpHhSRJg8Hivf4/Aghy1GcYMMGnF59tE1v5fBcu/WIKzRsoaaT9DeUJ2Dw9hp56xSi3PqBi5xeKU4meGp8pQYBwFAiIa0dDhAXONTPW8XcC4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1592892230855374.00637596121805; Mon, 22 Jun 2020 23:03:50 -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-305-8svpZYWINy2SaznNBP4eow-1; Tue, 23 Jun 2020 02:03:47 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4AF697BAD; Tue, 23 Jun 2020 06:03:42 +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 1196C10013D9; Tue, 23 Jun 2020 06:03:42 +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 D551F1809554; Tue, 23 Jun 2020 06:03:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05N63KxX016356 for ; Tue, 23 Jun 2020 02:03:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1C56660CD3; Tue, 23 Jun 2020 06:03:20 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88D9F60F80 for ; Tue, 23 Jun 2020 06:03:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592892229; 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=+OuoWBEh7wmymvRSFt3dzyRs4NqHckJznyf5wRBMQxk=; b=F2a0cXcUyx9jWxJBF3G1FF8gKfKlR5QAdl6nl1ZWT8lTeUBhRB6fcQGGQ3w731L1vlVy4K xo3cVE7dZIYRAj+0wzLSLyGUsKyO0E8hCbYaaOjEAk+NajbsniVq6SA2nmGGBdDPc4h1ss UZZDUXLa8x1xdfREB9+xuNJwY+QOxVA= X-MC-Unique: 8svpZYWINy2SaznNBP4eow-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/5] qemuBackupBegin: Don't leak 'def' on early failures Date: Tue, 23 Jun 2020 08:03:10 +0200 Message-Id: <9b7c81f5ead5d614d520d4cef6a3904fd7a0473f.1592892032.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.84 on 10.5.11.22 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" The cleanup path expects that 'def' is assigned to 'priv->backup', but that's not the case for early failures. Add a check to stop overwriting of 'def' so that it can be freed. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_backup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index db8b2d8ff9..531005425b 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -806,7 +806,7 @@ qemuBackupBegin(virDomainObjPtr vm, ignore_value(qemuDomainObjExitMonitor(priv->driver, vm)); } - if (ret < 0 && !job_started) + if (ret < 0 && !job_started && priv->backup) def =3D g_steal_pointer(&priv->backup); if (ret =3D=3D 0) --=20 2.26.2 From nobody Tue Apr 23 09:09:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1592892216; cv=none; d=zohomail.com; s=zohoarc; b=lmmJonMgy5XlUR4GMsCyAxv3qMPCDMuNgS9GLzzGDXp13SAD/IiP1qN0I5sCVuXRFNonTBFKO4RhqOnNB5JgypsA8cU8qXFWkGqyPtp76qE/nYU7MF7/vDu5ngcTm7HwtwJj6v1zh2Qe/ilkMiB+xx3ydCjCzMynLmYZDgU1Tgo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592892216; 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=5ogK25HsAd5N60BKBZLBN8hZYIjU4V+45Jfg79X/x7k=; b=eQu7ahb1iOkudZ6IsUQ5Spe3NVSeUziWMtqxfUSn7jrkiPHmg/Y4rc1XCxzMz0xLmiS/SHtmGRKBFcrGiEJMXkKaCe+t/HtflTNLpS2WeJb9huiZ1gdcxVmMFBGli5vDCk+ccwHkxpm+W1kYxrYEMqtQVpnJN1soUWS/wxZtSaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 159289221630676.48224002270183; Mon, 22 Jun 2020 23:03:36 -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-67-Usa0AVhzPoWHJVlrjhw_Ww-1; Tue, 23 Jun 2020 02:03:32 -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 F0137107ACCD; Tue, 23 Jun 2020 06:03:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E01087168D; Tue, 23 Jun 2020 06:03:25 +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 983E7833AB; Tue, 23 Jun 2020 06:03:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05N63Ld8016367 for ; Tue, 23 Jun 2020 02:03:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D0362AF4D; Tue, 23 Jun 2020 06:03:21 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75C5460CD3 for ; Tue, 23 Jun 2020 06:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592892215; 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=5ogK25HsAd5N60BKBZLBN8hZYIjU4V+45Jfg79X/x7k=; b=hD8jRE6nSDISU7Akmh6eQXxlZA0aIk9NorKm431E8ZQwp/rcLRd/ssFTk1qv0QkKM+acH3 KVkePCrOOnK86+ooT0fX48yKHaF8Kdn5+eAnLx5I/RmPVhGYvVrbvzhfKZBLYZbRh4Dh/1 Q28NEvpZiXih8M0FrPzYxX6KjOKfs3o= X-MC-Unique: Usa0AVhzPoWHJVlrjhw_Ww-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/5] qemu: backup: Initialize 'store' source properly and just once Date: Tue, 23 Jun 2020 08:03:11 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" Two functions called in sequence both initialized the virStorageSource backing 'store' leading to a memleak. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_backup.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 531005425b..43fe8942ad 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -272,9 +272,6 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm, dd->backingStore =3D dd->terminator =3D virStorageSourceNew(); } - if (qemuDomainStorageFileInit(priv->driver, vm, dd->store, dd->domdisk= ->src) < 0) - return -1; - if (qemuDomainPrepareStorageSourceBlockdev(NULL, dd->store, priv, cfg)= < 0) return -1; @@ -410,7 +407,7 @@ qemuBackupDiskPrepareOneStorage(virDomainObjPtr vm, return -1; } - if (qemuDomainStorageFileInit(priv->driver, vm, dd->store, NULL) <= 0) + if (qemuDomainStorageFileInit(priv->driver, vm, dd->store, dd->dom= disk->src) < 0) return -1; dd->initialized =3D true; --=20 2.26.2 From nobody Tue Apr 23 09:09:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1592892215; cv=none; d=zohomail.com; s=zohoarc; b=Vp3td1BD5KrWiwX65kkAQeem3CoDmeGlohFFnklsWSebv0mYNO+Any+FZnDcLoFTd7ogMwWRNXXXGsiUJvcGh/cPBEn3sDQGzh8uPXJsUC6NcS/PsDBjlbvijdzK8O/CU/auTeOVUcfeiMT7X5ziTTiRnqQDIQlAnZbFYBegTHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592892215; 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=Ill06vMRFGZ0GxbIgbsHWQATcfy9D14v+D3H7CFLNv4=; b=gvWX2T6dFkl4yzZ67+QAtJtFzBXT8sRjDCBOA3LGrIxmavGRleJalFKjoOaDFT0NHvAIRvUQ0mO4EMdGWyJXrfw7Xlc/e4A4E+ZnCpvClunAKcuWngeVDqp3UnWuJVw9AS5FMgVX9hr7MAOyENDr/GXbJw413VBifD/DWvSR7kY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1592892215594199.90092197713557; Mon, 22 Jun 2020 23:03:35 -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-431-ED5McGA9Phaa3UY2H9Q_1w-1; Tue, 23 Jun 2020 02:03:31 -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 B45778018AC; Tue, 23 Jun 2020 06:03:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57C047CCC0; Tue, 23 Jun 2020 06:03:26 +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 60CCE833C6; Tue, 23 Jun 2020 06:03:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05N63L6D016375 for ; Tue, 23 Jun 2020 02:03:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id EDBA560CD3; Tue, 23 Jun 2020 06:03:21 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63BAF6106A for ; Tue, 23 Jun 2020 06:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592892214; 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=Ill06vMRFGZ0GxbIgbsHWQATcfy9D14v+D3H7CFLNv4=; b=c4VT94rUUy6d98knA+GaeN3BdCBfRdznSsccoGClTvPiGf7Kp+glrvN4ZTOvhaBPlMpX96 2Qmh375UjiSZA6Snu/J2hBA/9zYf60N2fwOxDWMgw8NBFvM5fHHWh1mVrkNgU+8rkeaf5g sk5jE2cUHsSnUW/KunBdLynQ+jVdgr4= X-MC-Unique: ED5McGA9Phaa3UY2H9Q_1w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/5] qemuBackupDiskStarted: Fix improper dereference of array Date: Tue, 23 Jun 2020 08:03:12 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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" The code would repeatedly mark the first disk's blockjob as started rather than accessing all the blockjobs. Fix the dereferencing operator. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_backup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 43fe8942ad..ab9cd2689f 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -482,7 +482,7 @@ qemuBackupDiskStarted(virDomainObjPtr vm, for (i =3D 0; i < ndd; i++) { dd[i].started =3D true; dd[i].backupdisk->state =3D VIR_DOMAIN_BACKUP_DISK_STATE_RUNNING; - qemuBlockJobStarted(dd->blockjob, vm); + qemuBlockJobStarted(dd[i].blockjob, vm); } } --=20 2.26.2 From nobody Tue Apr 23 09:09:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1592892230; cv=none; d=zohomail.com; s=zohoarc; b=OL8996b0FTISQJQhJP/DkFvXq6qJHBfyQ0GBsYaFg7VSg3lG4UwhfudVfbtwIMnf3+9FCWmKvJC8wQ+PQEo9zZJRaR9e3C9KyU47rV12tnZZpmzNwuwtPvgWFEaiwpSesMN4JifkAI9SJDXLULfWjanc07eEtnJMuApLW1CbQZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592892230; 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=L8s5SPHYk4nmTkQuwOdWjmkaZstdAwkQ0rN2L9a4MCo=; b=bKcgrBMQ+LJjXCucJQAvo96HrYX6eh2m77uGc3NoUx/SkFCDbviN2ybD/3RpszK0rKQ0VnLILzaa/iBvytIu+2cQtBvaUZbKADfQDTxnfL04kC+vxqbXlxU5sCuVv8zwPsFXDS6GpIqLWyp/PK6j6xgw/oi546lspGmGcHOiqoQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1592892230559683.2442718402091; Mon, 22 Jun 2020 23:03:50 -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-196-fbhOuNLyMEGq1UhekrJmaw-1; Tue, 23 Jun 2020 02:03:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2CFE58031CD; Tue, 23 Jun 2020 06:03:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0DF8C5C241; Tue, 23 Jun 2020 06:03:42 +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 D36AA833D1; Tue, 23 Jun 2020 06:03:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05N63Mhn016385 for ; Tue, 23 Jun 2020 02:03:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id D8C4C60F80; Tue, 23 Jun 2020 06:03:22 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 541AE60CD3 for ; Tue, 23 Jun 2020 06:03:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592892229; 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=L8s5SPHYk4nmTkQuwOdWjmkaZstdAwkQ0rN2L9a4MCo=; b=LJLuMAwXcQhkhXktZ/LIwGdCMThcaKUSJZuA7ij+Di639R8XqJKRGuP9/OZjkwAKxYFMSJ H2YVszEvCMSFzsPqI9vUPatfLxtDAk6u2Z9wS3SiTApYyc+JtxxxEjflbQQXAajflEMzLo ekLZC1o3jNg/llO5X3ZWkxKLI0/Hy4U= X-MC-Unique: fbhOuNLyMEGq1UhekrJmaw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/5] qemuBackupDiskDataCleanupOne: Don't exit early when the job has started Date: Tue, 23 Jun 2020 08:03:13 +0200 Message-Id: <5243a9b81ec708bbf6e32312be0cb19554bb3b71.1592892032.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.16 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" Originally the function was cleaning up a failed job only but now there's other stuff that needs to be cleared too. Make only steps which clean up after a failed job depend on the 'started' field and execute the rest of the code always. This fixes a leak of the backup job tracking object and the blockdev-add helper data. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_backup.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index ab9cd2689f..3bd59402dc 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -124,26 +124,25 @@ qemuBackupDiskDataCleanupOne(virDomainObjPtr vm, { qemuDomainObjPrivatePtr priv =3D vm->privateData; - if (dd->started) - return; + if (!dd->started) { + if (dd->added) { + qemuDomainObjEnterMonitor(priv->driver, vm); + qemuBlockStorageSourceAttachRollback(priv->mon, dd->crdata->sr= cdata[0]); + ignore_value(qemuDomainObjExitMonitor(priv->driver, vm)); + } - if (dd->added) { - qemuDomainObjEnterMonitor(priv->driver, vm); - qemuBlockStorageSourceAttachRollback(priv->mon, dd->crdata->srcdat= a[0]); - ignore_value(qemuDomainObjExitMonitor(priv->driver, vm)); - } + if (dd->created) { + if (virStorageFileUnlink(dd->store) < 0) + VIR_WARN("Unable to remove just-created %s", NULLSTR(dd->s= tore->path)); + } - if (dd->created) { - if (virStorageFileUnlink(dd->store) < 0) - VIR_WARN("Unable to remove just-created %s", NULLSTR(dd->store= ->path)); + if (dd->labelled) + qemuDomainStorageSourceAccessRevoke(priv->driver, vm, dd->stor= e); } if (dd->initialized) virStorageFileDeinit(dd->store); - if (dd->labelled) - qemuDomainStorageSourceAccessRevoke(priv->driver, vm, dd->store); - if (dd->blockjob) qemuBlockJobStartupFinalize(vm, dd->blockjob); --=20 2.26.2 From nobody Tue Apr 23 09:09:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1592892232; cv=none; d=zohomail.com; s=zohoarc; b=Z3LyECK912NBQ86vDBhERbDCXRkcnasNDNSTKZkeLXCJEbMeIsoVkhKFAPorWgSLX1jrKirikprl9Cz2zSBAldJn5CV53VQcXOIm10fY/C1SYagEwLBQbjJnkd8/b3zh3VjDCNIS3IlQvSvu62ajMF4yKjSbpz6h1VKIEB/fAY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592892232; 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=IOK+AhjaU4sy/03LI1+lm03Ej59XPHljQW3EPvN/cpY=; b=XyuzZayhvCInx6g+0tSvKLTSBhNMcZ//P/QymlRcD/B77nnMEOROAngqI9J6PqQ17O8Q4a5LerhLqfhccSgRj8x76xCBG4yA1va+YLgpJPNrawMNkJ4PgzBR+qmEsfbaMGzgwBl7t4GzEgF0B1n47NqOwKKsYy3R/wLtQkKk74w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1592892232780283.6161620010773; Mon, 22 Jun 2020 23:03:52 -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-230-7y-QIFbWPG-mXKFoGK_P6A-1; Tue, 23 Jun 2020 02:03:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C63C18A8224; Tue, 23 Jun 2020 06:03:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4749D19D61; Tue, 23 Jun 2020 06:03:44 +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 1868D833D3; Tue, 23 Jun 2020 06:03:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05N63NAF016390 for ; Tue, 23 Jun 2020 02:03:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id C618960CD3; Tue, 23 Jun 2020 06:03:23 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E5DB60F80 for ; Tue, 23 Jun 2020 06:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592892231; 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=IOK+AhjaU4sy/03LI1+lm03Ej59XPHljQW3EPvN/cpY=; b=S1tGhnNdsPiw4MTaH+UceWOlZlAp66jEW1UVtuJsxZXE3G91Ukb9700PYaNd6noKMnk/lC 8tP41YohCC3ik6k/LtRMg+JqPxqpI5kQSX7e/QiARmpIOb5w4BwlIb1ukAv7DGtREAGO8k vnoR3CJmhtSCMYaYLQIa/JmaFYa59aA= X-MC-Unique: 7y-QIFbWPG-mXKFoGK_P6A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/5] qemuBackupDiskDataCleanupOne: Free 'incrementalBitmap' Date: Tue, 23 Jun 2020 08:03:14 +0200 Message-Id: <501a92b743bac149dac41592c5cb51f319985dfd.1592892032.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.84 on 10.5.11.23 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" The bitmap name used for the incremental backup would be leaked otherwise. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_backup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 3bd59402dc..8dc9d2504d 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -148,6 +148,7 @@ qemuBackupDiskDataCleanupOne(virDomainObjPtr vm, qemuBlockStorageSourceChainDataFree(dd->crdata); virObjectUnref(dd->terminator); + g_free(dd->incrementalBitmap); } --=20 2.26.2