An admin who writes a CPU list to ne_cpus can be told that the write succeeded while the driver is left with no CPU pool: remove_cpu() returns 1 for a CPU that went offline after the list was checked, and ne_set_kernel_param() only tests for a negative value. Return -EINVAL, as for a list that names an offline CPU. Fixes: ff8a4d3e3a99 ("nitro_enclaves: Add logic for setting an enclave vCPU") Signed-off-by: Alexander Graf --- drivers/virt/nitro_enclaves/ne_misc_dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c b/drivers/virt/nitro_enclaves/ne_misc_dev.c index 38fbc09cf6076..6db8cf5c80257 100644 --- a/drivers/virt/nitro_enclaves/ne_misc_dev.c +++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c @@ -388,6 +388,9 @@ static int ne_setup_cpu_pool(const char *ne_cpu_list) pr_err("%s: CPU %d is not offlined [rc=%d]\n", ne_misc_dev.name, cpu, rc); + if (rc > 0) + rc = -EINVAL; + goto online_cpus; } } -- 2.47.1