qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org, Hu Tao <hutao@cn.fujitsu.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	Alexey Kardashevskiy <aik@ozlabs.ru>,
	Nishanth Aravamudan <nacc@linux.vnet.ibm.com>,
	Anton Blanchard <anton@samba.org>,
	David Rientjes <rientjes@google.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PATCH 2/3] numa: Reject duplicate node IDs
Date: Thu, 26 Jun 2014 18:33:19 -0300	[thread overview]
Message-ID: <1403818400-13671-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1403818400-13671-1-git-send-email-ehabkost@redhat.com>

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>
---
 numa.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/numa.c b/numa.c
index 3de9116..e93407a 100644
--- a/numa.c
+++ b/numa.c
@@ -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",
-- 
1.9.3

  parent reply	other threads:[~2014-06-26 21:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 21:33 [Qemu-devel] [PATCH 0/3] Validate NUMA node IDs (reject duplicate/missing node IDs properly) Eduardo Habkost
2014-06-26 21:33 ` [Qemu-devel] [PATCH 1/3] numa: Keep track of NUMA nodes present on the command-line Eduardo Habkost
2014-06-27  3:10   ` Hu Tao
2014-06-26 21:33 ` Eduardo Habkost [this message]
2014-06-27  3:30   ` [Qemu-devel] [PATCH 2/3] numa: Reject duplicate node IDs Hu Tao
2014-06-26 21:33 ` [Qemu-devel] [PATCH 3/3] numa: Reject configuration if not all node IDs are present Eduardo Habkost
2014-06-27  3:33   ` Hu Tao
2014-06-27 13:08     ` Eduardo Habkost
2014-06-26 21:50 ` [Qemu-devel] [PATCH for 2.1 0/3] Validate NUMA node IDs (reject duplicate/missing node IDs properly) Eric Blake
2014-06-29 15:02 ` [Qemu-devel] [PATCH " Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403818400-13671-3-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=anton@samba.org \
    --cc=hutao@cn.fujitsu.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=nacc@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).