usb-bus: Don't allow attaching a device to a bus with no free ports

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
master
Hans de Goede 2011-05-27 14:46:27 +02:00 committed by Gerd Hoffmann
parent adddecb169
commit ee210d6390
1 changed files with 5 additions and 0 deletions

View File

@ -181,6 +181,11 @@ static void do_attach(USBDevice *dev)
dev->product_desc);
return;
}
if (bus->nfree == 0) {
fprintf(stderr, "Warning: tried to attach usb device %s to a bus with no free ports\n",
dev->product_desc);
return;
}
if (dev->port_path) {
QTAILQ_FOREACH(port, &bus->free, next) {
if (strcmp(port->path, dev->port_path) == 0) {