From patchwork Fri Mar 27 15:19:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 1262837 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=g4tuTwkv; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48plxC2rmGz9sNg for ; Sat, 28 Mar 2020 02:23:27 +1100 (AEDT) Received: from localhost ([::1]:43000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHqpR-0003Mf-Bu for incoming@patchwork.ozlabs.org; Fri, 27 Mar 2020 11:23:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41484) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHqmL-0006vx-4k for qemu-devel@nongnu.org; Fri, 27 Mar 2020 11:20:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHqmK-0005Gr-1d for qemu-devel@nongnu.org; Fri, 27 Mar 2020 11:20:12 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:37970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHqmJ-0005Br-TS for qemu-devel@nongnu.org; Fri, 27 Mar 2020 11:20:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585322411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fk0sEoSyk8D0WdjxUBUaxLMY5WyOh3Tqo/eYf9My26Y=; b=g4tuTwkvSHJJal0z9T3aP+juxxdR8Ms9MMVzPnTYli38IIlUkSJJcNvsd+alwLfzeyTUet 08VF8fRrlGiK2zKNRjq4LgzdwviUyWwc1bpe+P4JoIvwlsPUB1V336aDiuzt8/175qpm/A AMiv6DIjS6m2rgByYKnBH2LwKrGjfhg= 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-194-KVAwSHTqNcubNw_Y5A92cA-1; Fri, 27 Mar 2020 11:20:09 -0400 X-MC-Unique: KVAwSHTqNcubNw_Y5A92cA-1 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 F3275800D53; Fri, 27 Mar 2020 15:20:07 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-253.ams2.redhat.com [10.36.113.253]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40AA9177E5; Fri, 27 Mar 2020 15:20:05 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 2/6] block: fix bdrv_root_attach_child forget to unref child_bs Date: Fri, 27 Mar 2020 16:19:46 +0100 Message-Id: <20200327151950.11820-3-kwolf@redhat.com> In-Reply-To: <20200327151950.11820-1-kwolf@redhat.com> References: <20200327151950.11820-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Vladimir Sementsov-Ogievskiy bdrv_root_attach_child promises to drop child_bs reference on failure. It does it on first handled failure path, but not on the second. Fix that. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20200324155921.23822-1-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf --- block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block.c b/block.c index af3faf664e..2e3905c99e 100644 --- a/block.c +++ b/block.c @@ -2617,6 +2617,7 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs, error_propagate(errp, local_err); g_free(child); bdrv_abort_perm_update(child_bs); + bdrv_unref(child_bs); return NULL; } }