]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: range check numa memory placement mode
authorPeter Krempa <pkrempa@redhat.com>
Mon, 6 Jan 2014 13:26:14 +0000 (14:26 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 6 Jan 2014 15:11:49 +0000 (16:11 +0100)
commit6e7490c734a538983f9c5ae680cdb36edbaffe65
tree81d6a4bc19b1d603c3bbab9da2028c8d7bc81051
parent8b573a6b0d1ee9d99862104f28fee8bc7f949a9d
qemu: range check numa memory placement mode

https://bugzilla.redhat.com/show_bug.cgi?id=1047234

Add a range check for supported numa memory placement modes provided by
the user before setting them in the domain definition. Without the check
the user is able to provide a (yet) unknown mode which is then stored in
the domain definition. This potentially causes a NULL dereference when
the defintion is formatted into the XML.

To reproduce run:
 virsh numatune DOMNAME --mode 6 --nodeset 0

The XML will then contain:
  <numatune>
      <memory mode='(null)' nodeset='0'/>
  </numatune>

With this fix, the command fails:
 error: Unable to change numa parameters
 error: invalid argument: unsupported numa_mode: '6'
src/qemu/qemu_driver.c