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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

