Re: Race condition between driver_probe_device and device_shutdownâ
From: Alan Stern
Date: Wed May 23 2012 - 11:06:25 EST
On Wed, 23 May 2012, Ming Lei wrote:
> >> Do you think that a buggy driver should be able to prevent the system
> >> from shutting down?
>
> IMO, the buggy driver should be fixed first, not only in .probe or .release, but
> also in .runtime_resume, all may affect shutting down.
>
> >
> > The original intent of the shutdown callback was to just the hardware
> > part of the device shutdown and not do muck with kernel data structures
> > because just the device portion should be more reliable and was all
> > that is needed.
>
> The .shutdown callback pointer is got from device->driver, which is
> changed in probe and release path. Also runtime PM thing has been
> involved into shutting down recently, so looks not only hardware parts
> are involved now.
This is a tricky question. Overall I think you're probably right.
It's certainly true that holding the device lock across the shutdown
callback is the easiest and most reliable way to prevent these races.
Alan Stern
--
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/