From 2a7f2630684ee556a394a354d64159a4470c0151 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 3 Jul 2017 13:15:49 +0200 Subject: [PATCH] ehci: add sanity check for maxframes Reported-by: Peter Maydell Signed-off-by: Gerd Hoffmann Reviewed-by: Peter Maydell Message-id: 20170703111549.10924-1-kraxel@redhat.com Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-ehci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 73090e01ad..604912cb3e 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -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); -- 2.11.4.GIT