From patchwork Tue Oct 13 12:17:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 529708 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 50E4A14027C for ; Tue, 13 Oct 2015 23:19:22 +1100 (AEDT) Received: from localhost ([::1]:34205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlyY3-0003Hx-Sr for incoming@patchwork.ozlabs.org; Tue, 13 Oct 2015 08:19:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlyWf-0001Zd-GR for qemu-devel@nongnu.org; Tue, 13 Oct 2015 08:17:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlyWa-0005WD-0X for qemu-devel@nongnu.org; Tue, 13 Oct 2015 08:17:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlyWY-0005VR-7r; Tue, 13 Oct 2015 08:17:46 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id C600AA2C30; Tue, 13 Oct 2015 12:17:45 +0000 (UTC) Received: from noname.str.redhat.com (dhcp-192-197.str.redhat.com [10.33.192.197]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9DCHfKq011462; Tue, 13 Oct 2015 08:17:44 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 13 Oct 2015 14:17:40 +0200 Message-Id: <1444738660-18285-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1444738660-18285-1-git-send-email-kwolf@redhat.com> References: <1444738660-18285-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/2] blkverify: Fix BDS leak in .bdrv_open error path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Kevin Wolf Reviewed-by: Jeff Cody --- block/blkverify.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/blkverify.c b/block/blkverify.c index f8655ad..c5f8e8d 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -143,6 +143,9 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags, ret = 0; fail: + if (ret < 0) { + bdrv_unref_child(bs, bs->file); + } qemu_opts_del(opts); return ret; }