Re: [PATCH v2] usb: core: Solve race condition in anchor cleanup functions

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

 



Am Mittwoch, den 29.07.2020, 09:38 -0400 schrieb Alan Stern:
 
> > -     spin_lock_irq(&anchor->lock);
> > -     while (!list_empty(&anchor->urb_list)) {
> > -             victim = list_entry(anchor->urb_list.prev, struct urb,
> > -                                 anchor_list);
> > -             /* we must make sure the URB isn't freed before we kill it*/
> > -             usb_get_urb(victim);
> > -             spin_unlock_irq(&anchor->lock);
> > -             /* this will unanchor the URB */
> > -             usb_kill_urb(victim);
> > -             usb_put_urb(victim);
> > +     do {
> >                spin_lock_irq(&anchor->lock);
> 
> All you have to do is move this spin_lock_irq() above the start of the 
> outer loop...

usb_kill_urb() is unfortunately an operation that can sleep.

	Regards
		Oliver




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

  Powered by Linux