Re: Race condition between driver_probe_device and device_shutdown

2012-12-07 Thread Ming Lei
On Fri, Dec 7, 2012 at 11:25 PM, Alan Stern wrote: > On Fri, 7 Dec 2012, Ming Lei wrote: >> device_pm_lock() can prevent device_move() from being running. > > That wouldn't prevent problems during unbinding. Wedson is right; the Right. > places that lock dev->parent must save a local copy of de

Re: Race condition between driver_probe_device and device_shutdown

2012-12-07 Thread Alan Stern
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

Re: Race condition between driver_probe_device and device_shutdown

2012-12-07 Thread Ming Lei
On Fri, Dec 7, 2012 at 8:16 PM, Wedson Almeida Filho wrote: >> Because device_del() will put reference count of the parent, and the patch >> only focuses on race between probe/release and shutdown. > > Right. device_del() puts the reference count of the parent -- is it > guaranteed that device_del

Re: Race condition between driver_probe_device and device_shutdown

2012-12-07 Thread Wedson Almeida Filho
> Because device_del() will put reference count of the parent, and the patch > only focuses on race between probe/release and shutdown. Right. device_del() puts the reference count of the parent -- is it guaranteed that device_del() won't ever reassign dev->parent though (e.g., to NULL)? I don't t

Re: Race condition between driver_probe_device and device_shutdown

2012-12-06 Thread Ming Lei
On Fri, Dec 7, 2012 at 8:09 AM, Wedson Almeida Filho wrote: > I don't have the setup anymore, I'll give it a shot if I ever get back it > back. > > I have a question though: why do we need to get a reference to the > parent? If the assumption is that the callee can release its reference Because

Re: Race condition between driver_probe_device and device_shutdown

2012-12-06 Thread Wedson Almeida Filho
I don't have the setup anymore, I'll give it a shot if I ever get back it back. I have a question though: why do we need to get a reference to the parent? If the assumption is that the callee can release its reference to the parent, then one may also expect callees to reassign dev->parent (e.g., b

Re: Race condition between driver_probe_device and device_shutdown

2012-12-06 Thread Ming Lei
On Thu, Dec 6, 2012 at 5:11 PM, Wedson Almeida Filho wrote: > [Sorry for taking so long to respond, after a week of silence I > assumed I wouldn't get any responses, plus I had moved on to other > things.] > > I happen to still have the logs, the relevant part is pasted at the end. > > Answering s

Re: Race condition between driver_probe_device and device_shutdown

2012-12-06 Thread Wedson Almeida Filho
[Sorry for taking so long to respond, after a week of silence I assumed I wouldn't get any responses, plus I had moved on to other things.] I happen to still have the logs, the relevant part is pasted at the end. Answering some of the questions: the driver is on the platform bus, in fact, it's dr