Commit 5ff19b5e authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[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.)
parent d60e1832
......@@ -791,14 +791,22 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, unsigned char type,
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment