From nobody Mon May 6 03:31:00 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.zoho.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 1488884904181262.26522158427576; Tue, 7 Mar 2017 03:08:24 -0800 (PST) Received: from localhost ([::1]:49220 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clCyc-00013n-Qu for importer@patchew.org; Tue, 07 Mar 2017 06:08:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clCxs-0000zG-JW for qemu-devel@nongnu.org; Tue, 07 Mar 2017 06:07:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clCxr-0006kH-Rs for qemu-devel@nongnu.org; Tue, 07 Mar 2017 06:07:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52804) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clCxo-0006iE-N4; Tue, 07 Mar 2017 06:07:32 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B04697E9E8; Tue, 7 Mar 2017 11:07:31 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-32.pek2.redhat.com [10.72.8.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 570EC2D653; Tue, 7 Mar 2017 11:07:28 +0000 (UTC) From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 7 Mar 2017 19:07:21 +0800 Message-Id: <20170307110722.12583-2-famz@redhat.com> In-Reply-To: <20170307110722.12583-1-famz@redhat.com> References: <20170307110722.12583-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 07 Mar 2017 11:07:32 +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] [PATCH v2 1/2] block: Don't use error_abort in blk_new_open 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: Kevin Wolf , Jeff Cody , qemu-block@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" We have an errp and bdrv_root_attach_child can fail permission check, error_abort is not the best choice here. Signed-off-by: Fam Zheng --- block/block-backend.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block/block-backend.c b/block/block-backend.c index daa7908..5742c09 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -213,7 +213,12 @@ BlockBackend *blk_new_open(const char *filename, const= char *reference, } =20 blk->root =3D bdrv_root_attach_child(bs, "root", &child_root, - perm, BLK_PERM_ALL, blk, &error_abo= rt); + perm, BLK_PERM_ALL, blk, errp); + if (!blk->root) { + bdrv_unref(bs); + blk_unref(blk); + return NULL; + } =20 return blk; } --=20 2.9.3 From nobody Mon May 6 03:31:00 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.zoho.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 1488884990596231.62827308170267; Tue, 7 Mar 2017 03:09:50 -0800 (PST) Received: from localhost ([::1]:49227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clD00-000296-E5 for importer@patchew.org; Tue, 07 Mar 2017 06:09:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clCxv-00011p-Q1 for qemu-devel@nongnu.org; Tue, 07 Mar 2017 06:07:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clCxs-0006kT-Ix for qemu-devel@nongnu.org; Tue, 07 Mar 2017 06:07:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40074) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clCxq-0006ic-Jp; Tue, 07 Mar 2017 06:07:34 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C42083A7680; Tue, 7 Mar 2017 11:07:34 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-32.pek2.redhat.com [10.72.8.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59AFD2D654; Tue, 7 Mar 2017 11:07:32 +0000 (UTC) From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 7 Mar 2017 19:07:22 +0800 Message-Id: <20170307110722.12583-3-famz@redhat.com> In-Reply-To: <20170307110722.12583-1-famz@redhat.com> References: <20170307110722.12583-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 07 Mar 2017 11:07:34 +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] [PATCH v2 2/2] commit: Don't use error_abort in commit_start 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: Kevin Wolf , Jeff Cody , qemu-block@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" bdrv_set_backing_hd failure needn't be abort. Since we already have error parameter, use it. Signed-off-by: Fam Zheng --- block/commit.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/block/commit.c b/block/commit.c index 22a0a4d..55f5cee 100644 --- a/block/commit.c +++ b/block/commit.c @@ -316,8 +316,20 @@ void commit_start(const char *job_id, BlockDriverState= *bs, goto fail; } =20 - bdrv_set_backing_hd(commit_top_bs, top, &error_abort); - bdrv_set_backing_hd(overlay_bs, commit_top_bs, &error_abort); + bdrv_set_backing_hd(commit_top_bs, top, &local_err); + if (local_err) { + bdrv_unref(commit_top_bs); + commit_top_bs =3D NULL; + error_propagate(errp, local_err); + goto fail; + } + bdrv_set_backing_hd(overlay_bs, commit_top_bs, &local_err); + if (local_err) { + bdrv_unref(commit_top_bs); + commit_top_bs =3D NULL; + error_propagate(errp, local_err); + goto fail; + } =20 s->commit_top_bs =3D commit_top_bs; bdrv_unref(commit_top_bs); --=20 2.9.3