Re: [PATCH] driver core: fix shutdown races with probe/remove

From: Greg Kroah-Hartman
Date: Tue Jun 05 2012 - 16:21:39 EST


On Tue, Jun 05, 2012 at 01:09:45PM -0400, Alan Stern wrote:
> On Tue, 5 Jun 2012, Ming Lei wrote:
>
> > On Tue, Jun 5, 2012 at 10:47 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > Avoid running probe, that's fine. ?But avoiding remove can lead to
> > > problems, because the subsystem and the driver will no longer agree on
> > > who should manage the device.
> >
> > After device_shutdown() has been called, the whole system will enter power down
> > or reset later, so it doesn't matter if who should manage the device.
>
> Maybe. But there might be quite some time between the shutdown call
> and the eventual power-off or reboot.
>
> > Also once shutdown callback is called for the device, looks its other callbacks
> > should not touch the device any more.
>
> You shouldn't depend on that. Shutdown methods generally put the
> device into a state suitable for power-off or reboot; they don't often
> guarantee that the driver won't change the state later on.
>
> On the whole, it might be easier just to hold the device lock during
> the shutdown call.

That sounds much simpler to me.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/