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] [thread-next>] [day] [month] [year] [list]
Message-ID: <01cb23af-57b9-e595-e36b-8856d1c853f9@redhat.com>
Date:   Fri, 2 Sep 2016 15:53:01 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Luiz Capitulino <lcapitulino@...hat.com>, kvm@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, rkrcmar@...hat.com,
        rostedt@...dmis.org, mhiramat@...nel.org, mtosatti@...hat.com
Subject: Re: [PATCH 2/4] kvm: kvm_create_vm_debugfs(): cleanup on error



On 31/08/2016 19:05, Luiz Capitulino wrote:
> Memory and debugfs entries are leaked on error. Fix it.
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@...hat.com>
> ---
>  virt/kvm/kvm_main.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index c1dc45e..9293285 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -585,12 +585,12 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd)
>  					 sizeof(*kvm->debugfs_stat_data),
>  					 GFP_KERNEL);
>  	if (!kvm->debugfs_stat_data)
> -		return -ENOMEM;
> +		goto out_err;
>  
>  	for (p = debugfs_entries; p->name; p++) {
>  		stat_data = kzalloc(sizeof(*stat_data), GFP_KERNEL);
>  		if (!stat_data)
> -			return -ENOMEM;
> +			goto out_err;
>  
>  		stat_data->kvm = kvm;
>  		stat_data->offset = p->offset;
> @@ -599,9 +599,13 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd)
>  					 kvm->debugfs_dentry,
>  					 stat_data,
>  					 stat_fops_per_vm[p->kind]))
> -			return -ENOMEM;
> +			goto out_err;
>  	}
>  	return 0;
> +
> +out_err:
> +	kvm_destroy_vm_debugfs(kvm);
> +	return -ENOMEM;
>  }
>  
>  static struct kvm *kvm_create_vm(unsigned long type)
> 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ