Hrm.... I thought that when a device was removed, the data structure wasn't freed until after the disconnect() routine returned. If that's the case, then it would seem to make sense that none of the sub-structures (ie. the bus structure) would be freed either until after the device structure was freed.
Or is this something else?
Matt
On Thu, Nov 15, 2001 at 06:40:50PM -0800, 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
--
Matthew Dharm Home: [EMAIL PROTECTED]
Maintainer, Linux USB Mass Storage Driver
I'm just trying to think of a way to say "up yours" without getting fired.
-- Stef
User Friendly, 10/8/1998
msg02586/pgp00000.pgp
Description: PGP signature
