I thought the precedence was the other way round (if there is the chance 
of NULL pointers)?

On Thu, 15 Nov 2001, Greg KH wrote:

> Hi all,
> 
> Here's a tiny patch that fixes a potential oops that drivers could
> cause in usb_unlink_urb() and usb_submit_urb().  I traced down a race
> condition that the visor driver was ending up calling usb_unlink_urb()
> after it had been removed, and the urb->dev->bus was removed.
> 
> What do people think?  Should this patch be added?
> 
> thanks,
> 
> greg k-h
> 
> 
> 
> diff --minimal -Nru a/drivers/usb/usb.c b/drivers/usb/usb.c
> --- a/drivers/usb/usb.c       Thu Nov 15 17:33:05 2001
> +++ b/drivers/usb/usb.c       Thu Nov 15 17:33:05 2001
> @@ -1019,7 +1019,7 @@
>  /*-------------------------------------------------------------------*/
>  int usb_submit_urb(urb_t *urb)
>  {
> -     if (urb && urb->dev)
> +     if (urb && urb->dev && urb->dev->bus && urb->dev->bus->op)
>               return urb->dev->bus->op->submit_urb(urb);
>       else
>               return -ENODEV;
> @@ -1028,7 +1028,7 @@
>  /*-------------------------------------------------------------------*/
>  int usb_unlink_urb(urb_t *urb)
>  {
> -     if (urb && urb->dev)
> +     if (urb && urb->dev && urb->dev->bus && urb->dev->bus->op)
>               return urb->dev->bus->op->unlink_urb(urb);
>       else
>               return -ENODEV;
> 
> 
> _______________________________________________
> [EMAIL PROTECTED]
> To unsubscribe, use the last form field at:
> https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
> 

-- 
 /------------------------------------+-------------------------\
|Stephen J. Gowdy                     | SLAC, MailStop 17,       |
|http://www.slac.stanford.edu/~gowdy/ | 2575 Sand Hill Road,     |
|                                     | Menlo Park CA 94025, USA |
|EMail: [EMAIL PROTECTED]       | Tel: +1 650 926 3144     |
 \------------------------------------+-------------------------/



_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to