Re: Null Pointer BUG in uhci_hcd

From: Oliver Neukum
Date: Tue Jul 07 2009 - 10:08:18 EST


Am Dienstag, 7. Juli 2009 11:13:01 schrieb Jiri Kosina:
> [ adding linux-usb to CC ]
>
> On Sun, 5 Jul 2009, Michael S. Zick wrote:
> > Anyone with suggestions about this one?

Looks like we should test for presence before we switch off
autosuspend for khubd. Please test this diagnostic patch if this is
repeatable.

Regards
Oliver

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 2af3b4f..c5b3929 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -371,11 +371,16 @@ static void kick_khubd(struct usb_hub *hub)
{
unsigned long flags;

- /* Suppress autosuspend until khubd runs */
- to_usb_interface(hub->intfdev)->pm_usage_cnt = 1;
+ if (!hub) {
+ BUG();
+ return;
+ }

spin_lock_irqsave(&hub_event_lock, flags);
if (!hub->disconnected && list_empty(&hub->event_list)) {
+ /* Suppress autosuspend until khubd runs */
+ to_usb_interface(hub->intfdev)->pm_usage_cnt = 1;
+
list_add_tail(&hub->event_list, &hub_event_list);
wake_up(&khubd_wait);
}
@@ -384,6 +389,11 @@ static void kick_khubd(struct usb_hub *hub)

void usb_kick_khubd(struct usb_device *hdev)
{
+ if (!hdev) {
+ BUG();
+ return;
+ }
+
/* FIXME: What if hdev isn't bound to the hub driver? */
kick_khubd(hdev_to_hub(hdev));
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/