mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
numa: Reject duplicate node IDs
The same nodeid shouldn't appear multiple times in the command-line. In addition to detecting command-line mistakes, this will fix a bug where nb_numa_nodes may become larger than MAX_NODES (and cause out-of-bounds access on the numa_info array). Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
committed by
Michael S. Tsirkin
parent
1af878e049
commit
1945b9d8b0
@@ -62,6 +62,11 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
if (numa_info[nodenr].present) {
|
||||
error_setg(errp, "Duplicate NUMA nodeid: %" PRIu16, nodenr);
|
||||
return;
|
||||
}
|
||||
|
||||
for (cpus = node->cpus; cpus; cpus = cpus->next) {
|
||||
if (cpus->value > MAX_CPUMASK_BITS) {
|
||||
error_setg(errp, "CPU number %" PRIu16 " is bigger than %d",
|
||||
|
||||
Reference in New Issue
Block a user