]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
ehci: add sanity check for maxframes
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 3 Jul 2017 11:15:49 +0000 (13:15 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 17 Jul 2017 09:39:08 +0000 (11:39 +0200)
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20170703111549.10924-1-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-ehci.c

index 73090e01ad4b04681ac5cb53c002b9e0ef97bfb6..604912cb3e135c6c848ec0edf81a94a29857a55a 100644 (file)
@@ -2483,6 +2483,11 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
                    NB_PORTS);
         return;
     }
+    if (s->maxframes < 8 || s->maxframes > 512)  {
+        error_setg(errp, "maxframes %d out if range (8 .. 512)",
+                   s->maxframes);
+        return;
+    }
 
     usb_bus_new(&s->bus, sizeof(s->bus), s->companion_enable ?
                 &ehci_bus_ops_companion : &ehci_bus_ops_standalone, dev);