Re: [PATCH] KVM: x86: Fix off-by-one error in kvm_vcpu_ioctl_x86_setup_mce

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/05/20 00:56, Jim Mattson wrote:
> Bank_num is a one-based count of banks, not a zero-based index. It
> overflows the allocated space only when strictly greater than
> KVM_MAX_MCE_BANKS.
> 
> Fixes: a9e38c3e01ad ("KVM: x86: Catch potential overrun in MCE setup")
> Signed-off-by: Jue Wang <juew@xxxxxxxxxx>
> Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
> Reviewed-by: Peter Shier <pshier@xxxxxxxxxx>
> ---
>  arch/x86/kvm/x86.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index d786c7d27ce5..5bf45c9aa8e5 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3751,7 +3751,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
>  	unsigned bank_num = mcg_cap & 0xff, bank;
>  
>  	r = -EINVAL;
> -	if (!bank_num || bank_num >= KVM_MAX_MCE_BANKS)
> +	if (!bank_num || bank_num > KVM_MAX_MCE_BANKS)
>  		goto out;
>  	if (mcg_cap & ~(kvm_mce_cap_supported | 0xff | 0xff0000))
>  		goto out;
> 

Queued, thanks.

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux