All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Jordan Justen <jljusten@gmail.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
Date: Mon, 3 Jun 2013 09:57:22 +0300	[thread overview]
Message-ID: <20130603065722.GW4725@redhat.com> (raw)
In-Reply-To: <51A864C2.8090904@linux.vnet.ibm.com>

On Fri, May 31, 2013 at 04:52:18PM +0800, Xiao Guangrong wrote:
> Luiz Capitulino reported that guest refused to boot and qemu
> complained with:
> kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
> 
> It is caused by commit 235e8982ad that did double free for the memslot
> so that the second one raises the -EINVAL error
> 
> Fix it by reset memory size only if it is needed
> 
> Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Thanks, applied.

> ---
>  kvm-all.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index 8e7bbf8..405480e 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
>      if (s->migration_log) {
>          mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
>      }
> -    if (mem.flags & KVM_MEM_READONLY) {
> +
> +    if (slot->memory_size && mem.flags & KVM_MEM_READONLY) {
>          /* Set the slot size to 0 before setting the slot to the desired
>           * value. This is needed based on KVM commit 75d61fbc. */
>          mem.memory_size = 0;
> -- 
> 1.7.7.6

--
			Gleb.

WARNING: multiple messages have this Message-ID (diff)
From: Gleb Natapov <gleb@redhat.com>
To: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: KVM <kvm@vger.kernel.org>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Jordan Justen <jljusten@gmail.com>
Subject: Re: [Qemu-devel] [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
Date: Mon, 3 Jun 2013 09:57:22 +0300	[thread overview]
Message-ID: <20130603065722.GW4725@redhat.com> (raw)
In-Reply-To: <51A864C2.8090904@linux.vnet.ibm.com>

On Fri, May 31, 2013 at 04:52:18PM +0800, Xiao Guangrong wrote:
> Luiz Capitulino reported that guest refused to boot and qemu
> complained with:
> kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
> 
> It is caused by commit 235e8982ad that did double free for the memslot
> so that the second one raises the -EINVAL error
> 
> Fix it by reset memory size only if it is needed
> 
> Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Thanks, applied.

> ---
>  kvm-all.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index 8e7bbf8..405480e 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
>      if (s->migration_log) {
>          mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
>      }
> -    if (mem.flags & KVM_MEM_READONLY) {
> +
> +    if (slot->memory_size && mem.flags & KVM_MEM_READONLY) {
>          /* Set the slot size to 0 before setting the slot to the desired
>           * value. This is needed based on KVM commit 75d61fbc. */
>          mem.memory_size = 0;
> -- 
> 1.7.7.6

--
			Gleb.

  parent reply	other threads:[~2013-06-03  6:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 15:46 [Qemu-devel] [BUG]: kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument Luiz Capitulino
2013-05-30 16:03 ` Paolo Bonzini
2013-05-30 16:08   ` Luiz Capitulino
2013-05-30 16:50     ` Jordan Justen
2013-05-30 17:03       ` Luiz Capitulino
2013-05-30 17:32         ` Jordan Justen
2013-05-30 17:56           ` Luiz Capitulino
2013-05-30 18:05             ` Paolo Bonzini
2013-05-30 20:32               ` Luiz Capitulino
2013-05-30 21:23                 ` Paolo Bonzini
2013-05-30 23:43                   ` Jordan Justen
2013-05-31  6:51       ` Xiao Guangrong
2013-05-31  7:14         ` Jordan Justen
2013-05-31  8:01           ` Jordan Justen
2013-05-31  8:23         ` Paolo Bonzini
2013-05-31  8:52           ` [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem Xiao Guangrong
2013-05-31  8:52             ` [Qemu-devel] " Xiao Guangrong
2013-05-31 12:27             ` Paolo Bonzini
2013-05-31 12:27               ` [Qemu-devel] " Paolo Bonzini
2013-05-31 12:39             ` Luiz Capitulino
2013-05-31 12:39               ` [Qemu-devel] " Luiz Capitulino
2013-06-02 17:35             ` Richard W.M. Jones
2013-06-02 17:35               ` Richard W.M. Jones
2013-06-02 22:08             ` Jordan Justen
2013-06-02 22:08               ` [Qemu-devel] " Jordan Justen
2013-06-03  6:57             ` Gleb Natapov [this message]
2013-06-03  6:57               ` Gleb Natapov

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=20130603065722.GW4725@redhat.com \
    --to=gleb@redhat.com \
    --cc=jljusten@gmail.com \
    --cc=jordan.l.justen@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=lcapitulino@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiaoguangrong@linux.vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.