Messages in this thread | | | Date | Fri, 7 Dec 2012 10:25:59 -0500 (EST) | From | Alan Stern <> | Subject | Re: Race condition between driver_probe_device and device_shutdown |
| |
On Fri, 7 Dec 2012, Ming Lei wrote:
> > I guess the question is whether the callee is allowed to call > > device_move(), if not, we're good. > > Not only the callee, and other contexts can change device->parent > too. Looks rfcomm_tty_open() which calls device_move() is called > in open() context, so the parent might be changed before unlock(dev->parent) > in __driver_attach(). > > > > >> Your concern on device_remove() might be correct. Also, I am wondering > >> if we can walk the 'dpm_list' backwards for device shutdown, which should > >> be simpler and more reasonable. > > > > How would that help? > > device_pm_lock() can prevent device_move() from being running.
That wouldn't prevent problems during unbinding. Wedson is right; the places that lock dev->parent must save a local copy of dev->parent.
Alan Stern
| |