lkml.org 
[lkml]   [2003]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] More USB fixes for 2.5.68
From
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:35    [W:1.812 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site