Skip to contentSkip to conversation

Fix connect/disconnect race

USB Pete Zaitcev 2 participants 2 messages Dec 1, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines

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

drivers/usb/core/hub.c +0 -0
 			break;
 		}

drivers/usb/core/hub.c

Quoted 10 lines
drivers/usb/core/hub.c +3 -2
 
-		hub->children[port] = dev;
 		dev->state = USB_STATE_POWERED;
[...]
 		/* 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;
+		}

I'm surprised you need it. The updated usbfs is supposed to be immune. This is probably the reason it wasn't ported.

-- Pete

#2 lore raw
Quoted 9 lines · Pete Zaitcev
Quoted 9 lines

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

drivers/usb/core/hub.c +0 -0
 			break;
 		}
Quoted 12 lines

drivers/usb/core/hub.c

Quoted 9 lines
drivers/usb/core/hub.c +3 -2
-		hub->children[port] = dev;
 		dev->state = USB_STATE_POWERED;
[...]
 		/* 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;
+		}

I'm surprised you need it. The updated usbfs is supposed to be immune. This is probably the reason it wasn't ported.

Well the race occurs between usb_disconnect() initiated by rmmod uhci-hcd and this function.

Signature · 4 lines
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt