From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: Re: [PATCH] KVM: coalesced_mmio: NULLify the pointers before freeing ring page and dev Date: Fri, 12 Mar 2010 13:15:07 +0900 Message-ID: <4B99BFCB.5090903@oss.ntt.co.jp> References: <20100312120523.1b147c58.yoshikawa.takuya@oss.ntt.co.jp> <4B99B7F4.5090406@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org To: Wei Yongjun Return-path: Received: from serv2.oss.ntt.co.jp ([222.151.198.100]:55393 "EHLO serv2.oss.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808Ab0CLEMf (ORCPT ); Thu, 11 Mar 2010 23:12:35 -0500 In-Reply-To: <4B99B7F4.5090406@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: Wei Yongjun wrote: > 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. Eh, thanks. > >> Signed-off-by: Takuya Yoshikawa >> --- >> 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; >> > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html