[PATCH 10/19] nitro_enclaves: Do not report a torn down CPU pool as set
From: Alexander Graf
Date: Wed Nov 11 2026 - 22:11:25 EST
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 <graf@xxxxxxxxxx>
---
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 0a1080443fc72..1c2a4994257d1 100644
--- a/drivers/virt/nitro_enclaves/ne_misc_dev.c
+++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c
@@ -318,6 +318,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