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

From: Oliver Neukum
Date: Wed Oct 24 2007 - 10:04:28 EST


Am Dienstag 23 Oktober 2007 schrieb Pete Zaitcev:
> On Tue, 23 Oct 2007 11:38:37 +0200, Oliver Neukum <oliver@xxxxxxxxxx> 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

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