From patchwork Tue Mar 15 17:35:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8590851 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3D7DEC0553 for ; Tue, 15 Mar 2016 17:37:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B93720204 for ; Tue, 15 Mar 2016 17:37:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 08F722011B for ; Tue, 15 Mar 2016 17:37:36 +0000 (UTC) Received: from localhost ([::1]:50290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afsuV-0001lZ-Dm for patchwork-qemu-devel@patchwork.kernel.org; Tue, 15 Mar 2016 13:37:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afssL-0006Iw-2B for qemu-devel@nongnu.org; Tue, 15 Mar 2016 13:35:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afssK-0003ms-CH for qemu-devel@nongnu.org; Tue, 15 Mar 2016 13:35:20 -0400 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:34854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afssK-0003mm-5k for qemu-devel@nongnu.org; Tue, 15 Mar 2016 13:35:20 -0400 Received: by mail-wm0-x22c.google.com with SMTP id l68so159975195wml.0 for ; Tue, 15 Mar 2016 10:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=GznQTrt8nvM040ZfcJ0BgeWq0SB/m/6foRsu1gHCF/0=; b=qnKNltlUlcD++VPEgy4W7/LCmsdktyYZ0R9sTv0n5vvLm2L+dZc7g06J242a34RSU7 tsD1sNb4KhKq0G5iC3swyMbnq1AO4nD0A0FJyWL8vP7BYCZJRsGbVUkl6VwMhq0Rx7Pp GEmMcaRFogFBnPExM3RvtwwbBQauBKIJWQfTUa8rN7yAPA3Z1jd+/l4+InDmH3aLevt7 +PBISNN4kh3/dicfuSYks19F0Cdg1krjKJufIrV4a0ZMqib0Sru2Cb4Madd1LDgP5iYA KHFNbSfLf0qT95YY0H0pX1vpU/hEY6tDTMmRCnt0bPQMZrnHXvOyOepanxynSmBdCOUQ e6dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=GznQTrt8nvM040ZfcJ0BgeWq0SB/m/6foRsu1gHCF/0=; b=dH4R5tKnLlVTOGF7k1b3w/37mh2U1/NP6kZhhCefaxT+Xrlk2mLp4pWeN1CC32thtB A7vGD7jK8kqZGsVqIrxQ6HEdo8FvhtY2M9v8yjS+ncnUXMP4/oPOwn60VdCcUstzq9+A Cn8o+4S8VSF9Zu45Ve35FLYZl4jnQp7M6+3p7upg/KOrExvLZb+8m7+odZjjF8lgKeRe FFktKOI5+ijyRrkFdQfQD4879TlTw3s3+vbH40seH0q1j7AG9fx9k6tqjegacCjDWexw 8K2z1dUlufVOM8CIwcVfKMP6ivTr7NBEUNeePb+Fl6dO1tF3WumlTLcwgmJTRgXsBjI9 hfwA== X-Gm-Message-State: AD7BkJKQkCuzcPb7Ng65kVJz2TJOviFSfH96mGSQA3PzBS2z+7n3FRnOUphdJUtSS7SXFQ== X-Received: by 10.194.115.132 with SMTP id jo4mr30232918wjb.156.1458063319553; Tue, 15 Mar 2016 10:35:19 -0700 (PDT) Received: from 640k.lan (94-39-161-17.adsl-ull.clienti.tiscali.it. [94.39.161.17]) by smtp.gmail.com with ESMTPSA id z127sm21827680wme.5.2016.03.15.10.35.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Mar 2016 10:35:18 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 15 Mar 2016 18:35:07 +0100 Message-Id: <1458063310-128525-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1458063310-128525-1-git-send-email-pbonzini@redhat.com> References: <1458063310-128525-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22c Subject: [Qemu-devel] [PULL 5/8] exec: fix early return from ram_block_add 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP After reporting an error, ram_block_add was going on with the registration of the RAMBlock. The visible effect is that it unlocked the ramlist mutex twice. Fixes: 528f46af6ecd1e300db18684969104d4067b867b Reviewed-by: Fam Zheng Signed-off-by: Paolo Bonzini --- exec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exec.c b/exec.c index 274b619..f398d21 100644 --- a/exec.c +++ b/exec.c @@ -1589,6 +1589,7 @@ static void ram_block_add(RAMBlock *new_block, Error **errp) if (err) { error_propagate(errp, err); qemu_mutex_unlock_ramlist(); + return; } } else { new_block->host = phys_mem_alloc(new_block->max_length, @@ -1598,6 +1599,7 @@ static void ram_block_add(RAMBlock *new_block, Error **errp) "cannot set up guest memory '%s'", memory_region_name(new_block->mr)); qemu_mutex_unlock_ramlist(); + return; } memory_try_enable_merging(new_block->host, new_block->max_length); }