Re: USB: FIx locks and urb->status in adutux

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.usb.devel
Message-ID <[email protected]>
Am Dienstag 23 Oktober 2007 schrieb Pete Zaitcev:
> On Tue, 23 Oct 2007 11:38:37 +0200, Oliver Neukum <[email protected]> wrote:
> 
> > > +   /* XXX Anchor these instead */
> > > +   spin_lock_irqsave(&dev->buflock, flags);
> > > +   if (!dev->read_urb_finished) {
> > > +           spin_unlock_irqrestore(&dev->buflock, flags);
> > > +           usb_kill_urb(dev->interrupt_in_urb);
> > > +   } else
> > > +           spin_unlock_irqrestore(&dev->buflock, flags);
> 
> > Why bother? Simply call usb_kill_urb() unconditionally.
> 
> Is it always safe to kill unfilled URBs? The filled but unsubmitted ones
> are ok, but in this case it's possible that we only allocated something
> but never submitted. Our current implementation happens to be safe by
> virtue of ->dev being NULL in such case. I do not remember if we always
> guaranteed that and since Vitaly is going to take this code for a
> backport, I decided to play it safe.

I am not sure as far as 2.4 is concerned. In fact I am not sure 2.4 has
usb_kill_urb() at all.

	Regards
		Oliver
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.