Re: [PATCH v3] USB: fix thread-unsafe anchor utiliy routines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 4 Aug 2010, Oliver Neukum wrote:

> > @@ -749,20 +756,11 @@ EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs);
> >  void usb_unlink_anchored_urbs(struct usb_anchor *anchor)
> >  {
> >  	struct urb *victim;
> > -	unsigned long flags;
> >  
> > -	spin_lock_irqsave(&anchor->lock, flags);
> > -	while (!list_empty(&anchor->urb_list)) {
> > -		victim = list_entry(anchor->urb_list.prev, struct urb,
> > -				    anchor_list);
> > -		usb_get_urb(victim);
> > -		spin_unlock_irqrestore(&anchor->lock, flags);
> > -		/* this will unanchor the URB */
> > +	while ((victim = usb_get_from_anchor(anchor)) != NULL) {
> >  		usb_unlink_urb(victim);
> >  		usb_put_urb(victim);
> > -		spin_lock_irqsave(&anchor->lock, flags);
> >  	}
> > -	spin_unlock_irqrestore(&anchor->lock, flags);
> 
> This was written in the slightly convoluted manner out of fear that HCDs
> would call right back into usb_hcd_giveback_urb() which would unanchor
> the URB.
> 
> Alan, do we have HCD drivers that do that?

Yes, under some circumstances.  But it's not an issue here; the unlink 
call happens outside the scope of the anchor spinlock.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux