From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 4/4] usb/ohci: Fix crash with when specifying too many num-ports
Date: Mon, 23 May 2016 15:12:03 +0200 [thread overview]
Message-ID: <1464009123-5814-5-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1464009123-5814-1-git-send-email-kraxel@redhat.com>
From: Thomas Huth <thuth@redhat.com>
QEMU currently crashes when an OHCI controller is instantiated with
too many ports, e.g. "-device pci-ohci,num-ports=100,masterbus=1".
Thus add a proper check in usb_ohci_init() to make sure that we
do not use more than OHCI_MAX_PORTS = 15 ports here.
Ticket: https://bugs.launchpad.net/qemu/+bug/1581308
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1463995387-11710-1-git-send-email-thuth@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ohci.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index ffab561..16d9ff7 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1848,6 +1848,12 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState *dev,
ohci->as = as;
+ if (num_ports > OHCI_MAX_PORTS) {
+ error_setg(errp, "OHCI num-ports=%d is too big (limit is %d ports)",
+ num_ports, OHCI_MAX_PORTS);
+ return;
+ }
+
if (usb_frame_time == 0) {
#ifdef OHCI_TIME_WARP
usb_frame_time = NANOSECONDS_PER_SECOND;
--
1.8.3.1
next prev parent reply other threads:[~2016-05-23 13:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-23 13:11 [Qemu-devel] [PULL 0/4] usb: add xen pvUSB backend Gerd Hoffmann
2016-05-23 13:12 ` [Qemu-devel] [PULL 1/4] xen: introduce dummy system device Gerd Hoffmann
2016-05-23 13:12 ` [Qemu-devel] [PULL 2/4] xen: write information about supported backends Gerd Hoffmann
2016-05-23 13:12 ` [Qemu-devel] [PULL 3/4] xen: add pvUSB backend Gerd Hoffmann
2016-06-07 8:35 ` [Qemu-devel] [Xen-devel] " Olaf Hering
2016-06-10 10:38 ` Gerd Hoffmann
2016-06-13 7:55 ` Juergen Gross
2016-05-23 13:12 ` Gerd Hoffmann [this message]
2016-05-23 15:15 ` [Qemu-devel] [PULL 0/4] usb: add xen " Peter Maydell
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=1464009123-5814-5-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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).