Commit 08bceb43 authored by Herbert Xu's avatar Herbert Xu Committed by Greg Kroah-Hartman

[PATCH] USB: Fix connect/disconnect race

This patch was integrated by you in 2.4 six months ago.  Unfortunately
it never got into 2.5.  Without it you can end up with crashes such
as http://bugs.debian.org/218670
parent f6b1ebe8
...@@ -929,7 +929,6 @@ static void hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -929,7 +929,6 @@ static void hub_port_connect_change(struct usb_hub *hubstate, int port,
break; break;
} }
hub->children[port] = dev;
dev->state = USB_STATE_POWERED; dev->state = USB_STATE_POWERED;
/* Reset the device, and detect its speed */ /* Reset the device, and detect its speed */
...@@ -982,8 +981,10 @@ static void hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -982,8 +981,10 @@ static void hub_port_connect_change(struct usb_hub *hubstate, int port,
dev->dev.parent = dev->parent->dev.parent->parent; dev->dev.parent = dev->parent->dev.parent->parent;
/* Run it through the hoops (find a driver, etc) */ /* Run it through the hoops (find a driver, etc) */
if (!usb_new_device(dev, &hub->dev)) if (!usb_new_device(dev, &hub->dev)) {
hub->children[port] = dev;
goto done; goto done;
}
/* Free the configuration if there was an error */ /* Free the configuration if there was an error */
usb_put_dev(dev); usb_put_dev(dev);
...@@ -992,7 +993,6 @@ static void hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -992,7 +993,6 @@ static void hub_port_connect_change(struct usb_hub *hubstate, int port,
delay = HUB_LONG_RESET_TIME; delay = HUB_LONG_RESET_TIME;
} }
hub->children[port] = NULL;
hub_port_disable(hub, port); hub_port_disable(hub, port);
done: done:
up(&usb_address0_sem); up(&usb_address0_sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment