RE: Crash in dwc3 driver on module unload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Felipe Balbi [mailto:balbi@xxxxxx]
> Sent: Tuesday, April 09, 2013 12:42 AM
> 
> On Tue, Apr 09, 2013 at 02:36:51AM +0000, Paul Zimmerman wrote:
> > I'm getting a crash when I rmmod the dwc3-pci driver in latest Linus, and
> > also in 3.8.6 and 3.8.0.
> >
> > Screenshot (two parts) are here:
> > 	http://ompldr.org/vaTFibQ/IMG1.jpg
> > 	http://ompldr.org/vaTFicA/IMG2.jpg
> >
> > Unfortunately the very first part of the crash has scrolled off the
> > screen.
> >
> > I've decoded the crash a bit. The call chain descends through
> > platform_device_unregister(glue->dwc3) in dwc3_pci_remove(). It hits the
> > warning in kobject_put():
> >
> > 	void kobject_put(struct kobject *kobj)
> > 	{
> > 	        if (kobj) {
> > 	                if (!kobj->state_initialized)
> > 	                        WARN(1, KERN_WARNING "kobject: '%s' (%p): is not "
> > 	                               "initialized, yet kobject_put() is being "
> > 	                               "called.\n", kobject_name(kobj), kobj);
> > 	                kref_put(&kobj->kref, kobject_release);
> > 	        }
> > 	}
> >
> > and crashes when it tries to print the string, presumably because the
> > kobj->name field is either NULL or poisoned. So probably the kobject has
> > already been freed, or is in the process of being freed?
> >
> > Any ideas? Any debugging hints?
> 
> looks like the PHY is being unregistered too early. I believe that's
> because PHY's dev is just a pointer to the real dev and maybe that's
> what's wrong.
> 
> Here's what happens:
> 
> devm_usb_get_phy() will find the PHY and issue a get_device(phy->dev).
> phy->dev is initialized to (in your case) nop_xceiv's &pdev->dev.
> 
> When you remove dwc3.ko, due to devm_usb_phy_get(),
> devm_usb_phy_release() will get called which will issue a
> put_device(phy->dev), and that will trigger nop_xceiv's platform_device
> release, once you remove dwc3-pci.ko, you see the trigger.
> 
> I'm adding Kishon to the loop to help out figuring out what the best fix
> would be.

I found out a couple more things about this.

If I do "rmmod dwc3" first, and then do "rmmod dwc3-pci", it doesn't
crash.

On a related note, if I just do "modprobe dwc3-pci", then dwc3.ko
doesn't get loaded. I have to do "modprobe dwc3" too, to get
everything loaded. Shouldn't dwc3.ko be a dependency of dwc3-pci.ko,
and get loaded automatically? Could this missing dependency also
explain the crash on "rmmod dwc3-pci"?

-- 
Paul

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux