From 672583a091cdc4199e4c175e9f5585c6e0a65a35 Mon Sep 17 00:00:00 2001 From: Mingqiang Chi Date: Wed, 24 Oct 2018 13:30:48 +0800 Subject: [PATCH] hv: Check pcpu number in Hw platform detect if the physical number > CONFIG_MAX_PCPU_NUM, will return error and panic. Tracked-On: #861 Signed-off-by: Mingqiang Chi Reviewed-by: Li, Fei1 Acked-by: Eddie Dong --- hypervisor/arch/x86/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index ace52d3b7..6653823a3 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -259,6 +259,11 @@ static int hardware_detect_support(void) return -ENODEV; } + if (phys_cpu_num > CONFIG_MAX_PCPU_NUM) { + pr_fatal("%s, pcpu number(%d) is out of range\n", __func__, phys_cpu_num); + return -ENODEV; + } + ret = check_vmx_mmu_cap(); if (ret != 0) { return ret;