Messages in this thread Patch in this message | | | Subject | Re: [PATCH] More USB fixes for 2.5.68 | From | Greg KH <> | Date | Thu, 24 Apr 2003 16:47:32 -0700 |
| |
ChangeSet 1.1165.2.4, 2003/04/23 12:05:40-07:00, david-b@pacbell.net
[PATCH] usb: fix (rare?) disconnect
It's not good to dereference pointers before checking them for null. Seen once on a faulty device init, which I don't think I'd ever seen before "in the wild". (Caused by some other 2.5.68 strangeness.)
drivers/usb/core/usb.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c --- a/drivers/usb/core/usb.c Thu Apr 24 16:27:39 2003 +++ b/drivers/usb/core/usb.c Thu Apr 24 16:27:39 2003 @@ -791,14 +791,22 @@ void usb_disconnect(struct usb_device **pdev) { struct usb_device *dev = *pdev; - struct usb_bus *bus = dev->bus; - struct usb_operations *ops = bus->op; + struct usb_bus *bus; + struct usb_operations *ops; int i; might_sleep (); - if (!dev) + if (!dev) { + pr_debug ("%s nodev\n", __FUNCTION__); return; + } + bus = dev->bus; + if (!bus) { + pr_debug ("%s nobus\n", __FUNCTION__); + return; + } + ops = bus->op; *pdev = NULL; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |