qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] exec;fix early return from ram_block_add
@ 2016-03-09 17:16 Paolo Bonzini
  2016-03-10  1:05 ` Fam Zheng
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2016-03-09 17:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng

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
Cc: 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 d972737..11a5fa1 100644
--- a/exec.c
+++ b/exec.c
@@ -1588,6 +1588,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,
@@ -1597,6 +1598,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);
         }
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] exec;fix early return from ram_block_add
  2016-03-09 17:16 [Qemu-devel] [PATCH] exec;fix early return from ram_block_add Paolo Bonzini
@ 2016-03-10  1:05 ` Fam Zheng
  0 siblings, 0 replies; 2+ messages in thread
From: Fam Zheng @ 2016-03-10  1:05 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On Wed, 03/09 18:16, Paolo Bonzini wrote:

In the subject:

s/;/: /

> 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

Yes, this was my mistake in that patch. Thanks for the fix!

Reviewed-by: Fam Zheng <famz@redhat.com>

Fam

> Cc: 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 d972737..11a5fa1 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1588,6 +1588,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,
> @@ -1597,6 +1598,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);
>          }
> -- 
> 2.5.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-10  1:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 17:16 [Qemu-devel] [PATCH] exec;fix early return from ram_block_add Paolo Bonzini
2016-03-10  1:05 ` Fam Zheng

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).