[PATCH] fix memory leak on kvm_vm_ioctl_get_htab_fd

2017-08-22 Thread nixiaoming
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); but no free when anon_inode_getfd return fail so, add kfree(ctx) to fix memory leak Signed-off-by: nixiaoming --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc

[PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-22 Thread nixiaoming
miss kfree(stt) when anon_inode_getfd return fail so add check anon_inode_getfd return val, and kfree stt Signed-off-by: nixiaoming --- arch/powerpc/kvm/book3s_64_vio.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm

Re:Re: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-22 Thread Nixiaoming
>On 22.08.2017 17:15, David Hildenbrand wrote: >> On 22.08.2017 16:28, nixiaoming wrote: >>> miss kfree(stt) when anon_inode_getfd return fail so add check >>> anon_inode_getfd return val, and kfree stt >>> >>> Signed-off-by: nixiaoming >

答复: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread Nixiaoming
>On 23.08.2017 08:06, Paul Mackerras wrote: >> On Wed, Aug 23, 2017 at 01:43:08AM +, Nixiaoming wrote: >>>> On 22.08.2017 17:15, David Hildenbrand wrote: >>>>> On 22.08.2017 16:28, nixiaoming wrote: >>>>>> miss kfree(stt) when anon_inode_g

Re: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread Nixiaoming
>On 23.08.2017 08:06, Paul Mackerras wrote: >> On Wed, Aug 23, 2017 at 01:43:08AM +, Nixiaoming wrote: >>>> On 22.08.2017 17:15, David Hildenbrand wrote: >>>>> On 22.08.2017 16:28, nixiaoming wrote: >>>>>> miss kfree(stt) when anon_inode_g

RE: [PATCH] KVM: PPC: Book3S: Fix race and leak in kvm_vm_ioctl_create_spapr_tce()

2017-08-24 Thread Nixiaoming
>From: Paul Mackerras [mailto:pau...@ozlabs.org] Thursday, August 24, 2017 >11:40 AM > >Nixiaoming pointed out that there is a memory leak in >kvm_vm_ioctl_create_spapr_tce() if the call to anon_inode_getfd() fails; the >memory allocated for the kvmppc_spapr_tce_table struct

RE: [PATCH really v2] KVM: PPC: Book3S: Fix race and leak in kvm_vm_ioctl_create_spapr_tce()

2017-08-24 Thread Nixiaoming
On 24.08.2017 11:14, Paul Mackerras wrote: > Nixiaoming pointed out that there is a memory leak in > kvm_vm_ioctl_create_spapr_tce() if the call to anon_inode_getfd() > fails; the memory allocated for the kvmppc_spapr_tce_table struct is > not freed, and nor are the pages allocated f

[PATCH] [RESEND] KVM:PPC:Book3s: fix memory leak in kvm_vm_ioctl_get_htab_fd

2017-08-31 Thread nixiaoming
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); but no free when anon_inode_getfd return fail so, add kfree(ctx) to fix memory leak Signed-off-by: nixiaoming Reviewed-by: Paolo Bonzini --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kvm