[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1212071023090.1565-100000@iolanthe.rowland.org>
Date: Fri, 7 Dec 2012 10:25:59 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Ming Lei <ming.lei@...onical.com>
cc: Wedson Almeida Filho <wedsonaf@...il.com>,
Greg KH <gregkh@...uxfoundation.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Andrew Morton <akpm@...ux-foundation.org>,
<linux-kernel@...r.kernel.org>,
Linux PM List <linux-pm@...r.kernel.org>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists