Re: Null Pointer BUG in uhci_hcd

Michael S. Zick
2009-07-07T14:32:58Z

On Tue July 7 2009, Oliver Neukum wrote:
> 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.
>

Super! Will give it a try in todays build/testing and get back.

Note: If I understand the directions with this debug_vmalloc option,
this dump was caused by reference to a vmalloc'd page that had since
been freed. I have a copy of the dmesg at boot and the /sys/kernel/debug
list of PTE entries - - if that would help to know what cr2=0..50 was
pointing at.

Mike
> 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));
> }
>
>
>