aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/bus.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-03-20 11:40:02 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-04-03 11:39:43 +0200
commitc24e4aac3bd7dd6591e26b77985e5d3915ecbe4b (patch)
tree5baada12d24aa414379ba75d5e4b12142fca934c /hw/usb/bus.c
parent4b7b2afae773f00c785724261079ef211fd6021b (diff)
usb-hub: limit chain length
USB supports up to 5 hubs chained. Catch attempts to chain more. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/bus.c')
-rw-r--r--hw/usb/bus.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index e58cd9ade2..b10c290cf4 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -341,8 +341,10 @@ void usb_port_location(USBPort *downstream, USBPort *upstream, int portnr)
if (upstream) {
snprintf(downstream->path, sizeof(downstream->path), "%s.%d",
upstream->path, portnr);
+ downstream->hubcount = upstream->hubcount + 1;
} else {
snprintf(downstream->path, sizeof(downstream->path), "%d", portnr);
+ downstream->hubcount = 0;
}
}