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-next>] [day] [month] [year] [list]
Date:   Sat, 15 Feb 2020 02:00:16 +0000
From:   linmiaohe <linmiaohe@...wei.com>
To:     Haiwei Li <lihaiwei.kernel@...il.com>
CC:     "pbonzini@...hat.com" <pbonzini@...hat.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] KVM: Add the check and free to avoid unknown errors.

Hi:
Haiwei Li <lihaiwei.kernel@...il.com> wrote:
> From: Haiwei Li <lihaiwei@...cent.com>
>
> If 'kvm_create_vm_debugfs()' fails in 'kzalloc(sizeof(*stat_data), ...)', 'kvm_destroy_vm_debugfs()' will be called by the final fput(file) in 'kvm_dev_ioctl_create_vm()'.
>
> Add the check and free to avoid unknown errors.

Add the check and free? According to the code,it seem what you mean is "add the check against free" ?
 
>
> Signed-off-by: Haiwei Li <lihaiwei@...cent.com>
>
>   	if (kvm->debugfs_stat_data) {
> -		for (i = 0; i < kvm_debugfs_num_entries; i++)
> +		for (i = 0; i < kvm_debugfs_num_entries; i++) {
> +			if (!kvm->debugfs_stat_data[i])
> +				break;
>   			kfree(kvm->debugfs_stat_data[i]);
> +		}
>   		kfree(kvm->debugfs_stat_data);
>   	}
>   }

If (!kvm->debugfs_stat_data[i]) is checked in kfree() internal. And break early seems have no different effect.
Could you please explain what unknown errors may occur? And how? Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ