提交 ee210d63 编写于 作者: H Hans de Goede 提交者: Gerd Hoffmann

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

Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 adddecb1
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册