From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: coalesced_mmio: NULLify the pointers before freeing ring page and dev
Date: Fri, 12 Mar 2010 11:41:40 +0800 [thread overview]
Message-ID: <4B99B7F4.5090406@cn.fujitsu.com> (raw)
In-Reply-To: <20100312120523.1b147c58.yoshikawa.takuya@oss.ntt.co.jp>
Takuya Yoshikawa wrote:
> kvm_coalesced_mmio_init() keeps to hold the addresses of a coalesced mmio
> ring page and dev even after it has freed them.
>
> This may trigger problems, e.g., if we call kvm_coalesced_mmio_free() in
> kvm_destroy_vm() or kvm_vm_ioctl_register_coalesced_mmio() afterward.
>
> This patch avoids such problems by NULLifying the pointers.
>
After this patch, I think we also need to do some check in
kvm_vcpu_fault() for coalesced_mmio_ring, since the coalesced_mmio
may not be init correctly. This is other issue, so I will send a
new patch for this.
> Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
> ---
> virt/kvm/coalesced_mmio.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
> index 5169736..11776b7 100644
> --- a/virt/kvm/coalesced_mmio.c
> +++ b/virt/kvm/coalesced_mmio.c
> @@ -119,8 +119,10 @@ int kvm_coalesced_mmio_init(struct kvm *kvm)
> return ret;
>
> out_free_dev:
> + kvm->coalesced_mmio_dev = NULL;
> kfree(dev);
> out_free_page:
> + kvm->coalesced_mmio_ring = NULL;
> __free_page(page);
> out_err:
> return ret;
>
next prev parent reply other threads:[~2010-03-12 3:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-12 3:05 [PATCH] KVM: coalesced_mmio: NULLify the pointers before freeing ring page and dev Takuya Yoshikawa
2010-03-12 3:41 ` Wei Yongjun [this message]
2010-03-12 4:15 ` Takuya Yoshikawa
2010-03-12 3:43 ` [PATCH] KVM: fix to not use NULL kvm->coalesced_mmio_ring in kvm_vcpu_fault() Wei Yongjun
2010-03-12 4:22 ` Takuya Yoshikawa
2010-03-12 7:52 ` [PATCH -v2] KVM: fix kvm_coalesced_mmio_init()'s error handling Takuya Yoshikawa
2010-03-12 7:56 ` Wei Yongjun
2010-03-12 8:00 ` Takuya Yoshikawa
2010-03-12 9:57 ` [PATCH -v3 1/2] KVM: introduce kvm_uninit_mmu_notifier() Takuya Yoshikawa
2010-03-12 10:12 ` Takuya Yoshikawa
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=4B99B7F4.5090406@cn.fujitsu.com \
--to=yjwei@cn.fujitsu.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=yoshikawa.takuya@oss.ntt.co.jp \
/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