From nobody Sat May 4 08:19:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500995858207202.56220157926646; Tue, 25 Jul 2017 08:17:38 -0700 (PDT) Received: from localhost ([::1]:33155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da1aY-00060g-EN for importer@patchew.org; Tue, 25 Jul 2017 11:17:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da1Vw-0002AR-BQ for qemu-devel@nongnu.org; Tue, 25 Jul 2017 11:12:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1da1Vv-0007Ne-AL for qemu-devel@nongnu.org; Tue, 25 Jul 2017 11:12:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57198) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1da1Vr-0007MV-O3; Tue, 25 Jul 2017 11:12:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF469C013C4E; Tue, 25 Jul 2017 15:12:42 +0000 (UTC) Received: from localhost (ovpn-204-250.brq.redhat.com [10.40.204.250]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E0059653A; Tue, 25 Jul 2017 15:12:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CF469C013C4E Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mreitz@redhat.com From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 25 Jul 2017 17:12:31 +0200 Message-Id: <20170725151233.26077-2-mreitz@redhat.com> In-Reply-To: <20170725151233.26077-1-mreitz@redhat.com> References: <20170725151233.26077-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 25 Jul 2017 15:12:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/3] qcow: fix memory leaks related to encryption X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" Fix leak of the 'encryptopts' string, which was mistakenly declared const. Fix leak of QemuOpts entry which should not have been deleted from the opts array. Reported by: coverity Signed-off-by: Daniel P. Berrange Message-id: 20170714103105.5781-1-berrange@redhat.com Reviewed-by: Eric Blake Signed-off-by: Max Reitz --- block/qcow.c | 5 +++-- block/qcow2.c | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/block/qcow.c b/block/qcow.c index 66827d6..c08cdc4 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -768,7 +768,7 @@ static int qcow_create(const char *filename, QemuOpts *= opts, Error **errp) Error *local_err =3D NULL; int ret; BlockBackend *qcow_blk; - const char *encryptfmt =3D NULL; + char *encryptfmt =3D NULL; QDict *options; QDict *encryptopts =3D NULL; QCryptoBlockCreateOptions *crypto_opts =3D NULL; @@ -793,7 +793,7 @@ static int qcow_create(const char *filename, QemuOpts *= opts, Error **errp) goto cleanup; } } else if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ENCRYPT, false)) { - encryptfmt =3D "aes"; + encryptfmt =3D g_strdup("aes"); } =20 ret =3D bdrv_create_file(filename, opts, &local_err); @@ -908,6 +908,7 @@ exit: blk_unref(qcow_blk); cleanup: QDECREF(encryptopts); + g_free(encryptfmt); qcrypto_block_free(crypto); qapi_free_QCryptoBlockCreateOptions(crypto_opts); g_free(backing_file); diff --git a/block/qcow2.c b/block/qcow2.c index 90efa44..d7c600b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2905,7 +2905,7 @@ static int qcow2_create(const char *filename, QemuOpt= s *opts, Error **errp) int version; uint64_t refcount_bits; int refcount_order; - const char *encryptfmt =3D NULL; + char *encryptfmt =3D NULL; Error *local_err =3D NULL; int ret; =20 @@ -2916,14 +2916,14 @@ static int qcow2_create(const char *filename, QemuO= pts *opts, Error **errp) backing_fmt =3D qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FMT); encryptfmt =3D qemu_opt_get_del(opts, BLOCK_OPT_ENCRYPT_FORMAT); if (encryptfmt) { - if (qemu_opt_get_del(opts, BLOCK_OPT_ENCRYPT)) { + if (qemu_opt_get(opts, BLOCK_OPT_ENCRYPT)) { error_setg(errp, "Options " BLOCK_OPT_ENCRYPT " and " BLOCK_OPT_ENCRYPT_FORMAT " are mutually exclusive"); ret =3D -EINVAL; goto finish; } } else if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ENCRYPT, false)) { - encryptfmt =3D "aes"; + encryptfmt =3D g_strdup("aes"); } cluster_size =3D qcow2_opt_get_cluster_size_del(opts, &local_err); if (local_err) { @@ -2983,6 +2983,7 @@ static int qcow2_create(const char *filename, QemuOpt= s *opts, Error **errp) finish: g_free(backing_file); g_free(backing_fmt); + g_free(encryptfmt); g_free(buf); return ret; } --=20 2.9.4 From nobody Sat May 4 08:19:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500996372673149.61404752497606; Tue, 25 Jul 2017 08:26:12 -0700 (PDT) Received: from localhost ([::1]:33205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da1iq-0004Y3-94 for importer@patchew.org; Tue, 25 Jul 2017 11:26:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da1Vx-0002Be-O4 for qemu-devel@nongnu.org; Tue, 25 Jul 2017 11:12:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1da1Vx-0007OA-02 for qemu-devel@nongnu.org; Tue, 25 Jul 2017 11:12:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18722) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1da1Vu-0007NL-U1; Tue, 25 Jul 2017 11:12:47 -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 mx1.redhat.com (Postfix) with ESMTPS id 01C4F7F405; Tue, 25 Jul 2017 15:12:46 +0000 (UTC) Received: from localhost (ovpn-204-250.brq.redhat.com [10.40.204.250]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 581D28F34D; Tue, 25 Jul 2017 15:12:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 01C4F7F405 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mreitz@redhat.com From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 25 Jul 2017 17:12:32 +0200 Message-Id: <20170725151233.26077-3-mreitz@redhat.com> In-Reply-To: <20170725151233.26077-1-mreitz@redhat.com> References: <20170725151233.26077-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 25 Jul 2017 15:12:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/3] qcow2-bitmap: fix bitmap_free X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Fix possible crash on error path in qcow2_remove_persistent_dirty_bitmap. Although bitmap_free was added in 88ddffae8fc the bug was introduced later in commit 469c71edc72 (when qcow2_remove_persistent_dirty_bitmap was added). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20170714123341.373857-1-vsementsov@virtuozzo.com Signed-off-by: Max Reitz --- block/qcow2-bitmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index 3e8735a..e8d3bdb 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -487,6 +487,10 @@ static inline void bitmap_directory_to_be(uint8_t *dir= , size_t size) =20 static void bitmap_free(Qcow2Bitmap *bm) { + if (bm =3D=3D NULL) { + return; + } + g_free(bm->name); g_free(bm); } --=20 2.9.4 From nobody Sat May 4 08:19:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500996024858518.9976831601248; Tue, 25 Jul 2017 08:20:24 -0700 (PDT) Received: from localhost ([::1]:33166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da1dC-0008FT-Fl for importer@patchew.org; Tue, 25 Jul 2017 11:20:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da1W3-0002HE-Mt for qemu-devel@nongnu.org; Tue, 25 Jul 2017 11:12:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1da1W2-0007Pt-PL for qemu-devel@nongnu.org; Tue, 25 Jul 2017 11:12:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55230) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1da1Vx-0007OG-Tl; Tue, 25 Jul 2017 11:12:50 -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 mx1.redhat.com (Postfix) with ESMTPS id 0068A37EEC; Tue, 25 Jul 2017 15:12:49 +0000 (UTC) Received: from localhost (ovpn-204-250.brq.redhat.com [10.40.204.250]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A70865EB0; Tue, 25 Jul 2017 15:12:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0068A37EEC Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mreitz@redhat.com From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 25 Jul 2017 17:12:33 +0200 Message-Id: <20170725151233.26077-4-mreitz@redhat.com> In-Reply-To: <20170725151233.26077-1-mreitz@redhat.com> References: <20170725151233.26077-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 25 Jul 2017 15:12:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/3] qemu-iotests: Fix reference output for 186 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Kevin Wolf Commits 70f17a1 ('error: Revert unwanted change of warning messages') and e1824e5 ('qemu-iotests: Test 'info block'') had a semantic merge conflict, which results in failure for qemu-iotests case 186. Fix the reference output to consider the changes of 70f17a1. Signed-off-by: Kevin Wolf Message-id: 1500973176-29235-1-git-send-email-kwolf@redhat.com Reviewed-by: Markus Armbruster Reviewed-by: Stefan Hajnoczi Signed-off-by: Max Reitz --- tests/qemu-iotests/186.out | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/186.out b/tests/qemu-iotests/186.out index b963b12..b8bf9a2 100644 --- a/tests/qemu-iotests/186.out +++ b/tests/qemu-iotests/186.out @@ -442,7 +442,7 @@ ide0-cd0 (NODE_NAME): null-co:// (null-co, read-only) Cache mode: writeback (qemu) quit =20 -warning: qemu-system-x86_64: -drive if=3Dscsi,driver=3Dnull-co: bus=3D0,un= it=3D0 is deprecated with this machine type +qemu-system-x86_64: -drive if=3Dscsi,driver=3Dnull-co: warning: bus=3D0,un= it=3D0 is deprecated with this machine type Testing: -drive if=3Dscsi,driver=3Dnull-co QEMU X.Y.Z monitor - type 'help' for more information (qemu) info block @@ -451,7 +451,7 @@ scsi0-hd0 (NODE_NAME): null-co:// (null-co) Cache mode: writeback (qemu) quit =20 -warning: qemu-system-x86_64: -drive if=3Dscsi,media=3Dcdrom: bus=3D0,unit= =3D0 is deprecated with this machine type +qemu-system-x86_64: -drive if=3Dscsi,media=3Dcdrom: warning: bus=3D0,unit= =3D0 is deprecated with this machine type Testing: -drive if=3Dscsi,media=3Dcdrom QEMU X.Y.Z monitor - type 'help' for more information (qemu) info block @@ -460,7 +460,7 @@ scsi0-cd0: [not inserted] Removable device: not locked, tray closed (qemu) quit =20 -warning: qemu-system-x86_64: -drive if=3Dscsi,driver=3Dnull-co,media=3Dcdr= om: bus=3D0,unit=3D0 is deprecated with this machine type +qemu-system-x86_64: -drive if=3Dscsi,driver=3Dnull-co,media=3Dcdrom: warni= ng: bus=3D0,unit=3D0 is deprecated with this machine type Testing: -drive if=3Dscsi,driver=3Dnull-co,media=3Dcdrom QEMU X.Y.Z monitor - type 'help' for more information (qemu) info block --=20 2.9.4