linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [USB] Fix connect/disconnect race
@ 2003-11-30  7:48 Herbert Xu
  2003-12-10  1:38 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2003-11-30  7:48 UTC (permalink / raw)
  To: Greg KH, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

Hi Greg:

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

Cheers,
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 1060 bytes --]

Index: kernel-source-2.5/drivers/usb/core/hub.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/drivers/usb/core/hub.c,v
retrieving revision 1.1.1.15
diff -u -r1.1.1.15 hub.c
--- kernel-source-2.5/drivers/usb/core/hub.c	28 Sep 2003 04:44:16 -0000	1.1.1.15
+++ kernel-source-2.5/drivers/usb/core/hub.c	30 Nov 2003 07:44:40 -0000
@@ -926,7 +926,6 @@
 			break;
 		}
 
-		hub->children[port] = dev;
 		dev->state = USB_STATE_POWERED;
 
 		/* Reset the device, and detect its speed */
@@ -979,8 +978,10 @@
 		dev->dev.parent = dev->parent->dev.parent->parent;
 
 		/* 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;
+		}
 
 		/* Free the configuration if there was an error */
 		usb_put_dev(dev);
@@ -989,7 +990,6 @@
 		delay = HUB_LONG_RESET_TIME;
 	}
 
-	hub->children[port] = NULL;
 	hub_port_disable(hub, port);
 done:
 	up(&usb_address0_sem);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [USB] Fix connect/disconnect race
  2003-11-30  7:48 [USB] Fix connect/disconnect race Herbert Xu
@ 2003-12-10  1:38 ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2003-12-10  1:38 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Linux Kernel Mailing List

On Sun, Nov 30, 2003 at 06:48:14PM +1100, Herbert Xu wrote:
> Hi Greg:
> 
> 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

Thanks, I've applied this and will send it on.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [USB] Fix connect/disconnect race
  2003-12-01  2:03 ` Pete Zaitcev
@ 2003-12-01  7:16   ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2003-12-01  7:16 UTC (permalink / raw)
  To: Pete Zaitcev; +Cc: linux-kernel

On Sun, Nov 30, 2003 at 09:03:34PM -0500, Pete Zaitcev wrote:
> > 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
> 
> > --- kernel-source-2.5/drivers/usb/core/hub.c	28 Sep 2003 04:44:16 -0000	1.1.1.15
> > +++ kernel-source-2.5/drivers/usb/core/hub.c	30 Nov 2003 07:44:40 -0000
> >  			break;
> >  		}
> >  
> > -		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.
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [USB] Fix connect/disconnect race
       [not found] <mailman.1070178780.32610.linux-kernel2news@redhat.com>
@ 2003-12-01  2:03 ` Pete Zaitcev
  2003-12-01  7:16   ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Pete Zaitcev @ 2003-12-01  2:03 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-kernel

> 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

> --- kernel-source-2.5/drivers/usb/core/hub.c	28 Sep 2003 04:44:16 -0000	1.1.1.15
> +++ kernel-source-2.5/drivers/usb/core/hub.c	30 Nov 2003 07:44:40 -0000
>  			break;
>  		}
>  
> -		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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-12-10  2:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-30  7:48 [USB] Fix connect/disconnect race Herbert Xu
2003-12-10  1:38 ` Greg KH
     [not found] <mailman.1070178780.32610.linux-kernel2news@redhat.com>
2003-12-01  2:03 ` Pete Zaitcev
2003-12-01  7:16   ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).