qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 5/8] exec: fix early return from ram_block_add
Date: Tue, 15 Mar 2016 18:35:07 +0100	[thread overview]
Message-ID: <1458063310-128525-6-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1458063310-128525-1-git-send-email-pbonzini@redhat.com>

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 <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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);
         }
-- 
1.8.3.1

  parent reply	other threads:[~2016-03-15 17:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 17:35 [Qemu-devel] [PULL 0/8] Memory, icount, chardev, KVM changes for 2016-03-15 Paolo Bonzini
2016-03-15 17:35 ` [Qemu-devel] [PULL 1/8] kvm: x86: q35: Add support for -machine kernel_irqchip=split for q35 Paolo Bonzini
2016-03-15 17:35 ` [Qemu-devel] [PULL 2/8] update-linux-headers: Add userfaultfd.h Paolo Bonzini
2016-03-15 17:35 ` [Qemu-devel] [PULL 3/8] exec: Fix memory allocation when memory path names new file Paolo Bonzini
2016-03-15 17:35 ` [Qemu-devel] [PULL 4/8] exec: Fix memory allocation when memory path isn't on hugetlbfs Paolo Bonzini
2016-03-15 17:35 ` Paolo Bonzini [this message]
2016-03-15 17:35 ` [Qemu-devel] [PULL 6/8] replay: character devices Paolo Bonzini
2016-03-15 17:35 ` [Qemu-devel] [PULL 7/8] icount: remove obsolete warp call Paolo Bonzini
2016-03-15 17:35 ` [Qemu-devel] [PULL 8/8] icount: decouple warp calls Paolo Bonzini
2016-03-16  9:27 ` [Qemu-devel] [PULL 0/8] Memory, icount, chardev, KVM changes for 2016-03-15 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458063310-128525-6-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).