]> git.ipfire.org Git - thirdparty/qemu.git/commit
pc-dimm: fix crash when invalid slot number is used
authorIgor Mammedov <imammedo@redhat.com>
Tue, 23 Jul 2019 16:08:59 +0000 (12:08 -0400)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 3 Oct 2019 18:39:59 +0000 (13:39 -0500)
commita81a7fc22e0e185ddaa878d44e92ea7776f1b8a5
tree976ce142e9aaef735365a062a79c61a093b66f36
parentb65e78320bba2655b60355739ed1a1da2ccc6c78
pc-dimm: fix crash when invalid slot number is used

QEMU will crash with:
  Segmentation fault (core dumped)
when negative slot number is used, ex:
  qemu-system-x86_64 -m 1G,maxmem=20G,slots=256 \
      -object memory-backend-ram,id=mem1,size=1G \
      -device pc-dimm,id=dimm1,memdev=mem1,slot=-2

fix it by checking that slot number is within valid range.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20190723160859.27250-1-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Igor Mammedov &lt;<a href="mailto:imammedo@redhat.com" target="_blank">imammedo@redhat.com</a>&gt;<br></blockquote><div><br></div><div>Reviewed-by: Li Qiang &lt;<a href="mailto:liq3ea@gmail.com">liq3ea@gmail.com</a>&gt;<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Reviewed-by: Pankaj Gupta <pagupta@redhat.com>
(cherry picked from commit 22235bb609c18547cf6b215bad1f9d2ec56ad371)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/mem/pc-dimm.c