On Mon, Apr 28, 2014 at 2:00 PM, Dan Williams <dan.j.williams@xxxxxxxxx> wrote: > On Mon, Apr 28, 2014 at 1:29 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: >> On Wed, 19 Mar 2014, Dan Williams wrote: [..] >> But this got me thinking... It looks like the reference to >> port_dev->child in usb_port_runtime_resume() already races with the >> line >> >> *pdev = NULL; >> >> in usb_disconnect(). We need to make sure that a port runtime-resume >> is mutually exclusive with child device removal. (Consider, for >> example, what happens if a thread does a runtime resume on a port and >> at the same time, the hub is unplugged.) Any ideas? > > Yes, I think we simply need to add > pm_runtime_{get|put}(&port_dev->dev) to guarantee that port_dev->child > is always safe to de-reference in usb_port_runtime{suspend|resume}. ...and as I go to add this I notice that prior to the "use pm_request_resume" suggestion we don't de-reference port_dev->child in usb_port_runtime_resume(). This realization plus the usage count tracking that usb_remote_wakeup() affords is leaning me towards leaving the "force wakeup" mechanism as is for the upcoming re-post. -- 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