Am Freitag, 14. Mai 2004 21:25 schrieb Alan Stern:
> On Thu, 13 May 2004, Oliver Neukum wrote:
>
> > Am Donnerstag, 13. Mai 2004 20:02 schrieb Alan Stern:
> > > +void usb_kill_urb(struct urb *urb)
> > > +{
> > > + urb->transfer_flags |= (URB_ASYNC_UNLINK | URB_REJECT);
> > > + usb_unlink_urb(urb);
> > > + wait_event(urb->handler_queue, atomic_read(&urb->use_count) == 0);
> > > + urb->transfer_flags &= ~(URB_ASYNC_UNLINK | URB_REJECT);
> > > +}
> > > +
> >
> > Here I see a little problem.
> > 1. URB_REJECT
> > You cannot simply define a new transfer_flag, because the completion
> > handler may clear transfer_flags. Either add a further field, or use maskes
> > in in the fill_urb functions
>
> That's a good objection.
>
> Right now, none of the completion handlers under drivers/usb clears the
> transfer flags. But that's no guarantee about the future.
I overlooked something. Currently you cannot write to transfer_flags in the
handler at all. It's a classical race. I suggest that we make it a requirement
to hold urb->lock in the handler if you touch transfer_flags and take
the lock in usb_kill_urb()
Regards
Oliver
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel