lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e4c48fc6-3282-b3fe-60dd-3f4c911c6e91@redhat.com>
Date:   Tue, 22 Aug 2017 17:51:09 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     nixiaoming <nixiaoming@...wei.com>, agraf@...e.com,
        rkrcmar@...hat.com, benh@...nel.crashing.org, paulus@...ba.org,
        mpe@...erman.id.au
Cc:     kvm-ppc@...r.kernel.org, kvm@...r.kernel.org,
        linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fix memory leak on kvm_vm_ioctl_get_htab_fd

On 22/08/2017 16:18, nixiaoming wrote:
> 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 <nixiaoming@...wei.com>
> ---
>  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/kvm/book3s_64_mmu_hv.c
> index b42812e..be3d08f 100644
> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
> +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> @@ -1940,6 +1940,7 @@ int kvm_vm_ioctl_get_htab_fd(struct kvm *kvm, struct kvm_get_htab_fd *ghf)
>  	rwflag = (ghf->flags & KVM_GET_HTAB_WRITE) ? O_WRONLY : O_RDONLY;
>  	ret = anon_inode_getfd("kvm-htab", &kvm_htab_fops, ctx, rwflag | O_CLOEXEC);
>  	if (ret < 0) {
> +		kfree(ctx);
>  		kvm_put_kvm(kvm);
>  		return ret;
>  	}
> 

Reviewed-by: Paolo Bonzini <pbonzini@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ