mbox series

[0/3] Fix races on device removal

Message ID cover.1594214103.git.lukas@wunner.de (mailing list archive)
Headers show
Series Fix races on device removal | expand

Message

Lukas Wunner July 8, 2020, 1:27 p.m. UTC
Prevent dynamic SPI device addition below a controller which is
being removed.  To do so, set the controller's "dead" flag using
kill_device() (patch [3/3]).

Serialize access to a device's "dead" flag with a newly introduced
rw_semaphore in lieu of the device_lock to avoid deadlocks occurring
with the new use case (patch [2/3]).

Add a missing check for the "dead" flag upon driver binding
(patch [1/3]).


Lukas Wunner (3):
  driver core: Avoid binding drivers to dead devices
  driver core: Use rwsem for kill_device() serialization
  driver core: Avoid adding children below a dead parent

 drivers/base/base.h  |  2 ++
 drivers/base/core.c  | 49 ++++++++++++++++++++++++++++++--------------
 drivers/base/dd.c    | 12 ++++++++++-
 drivers/nvdimm/bus.c |  8 +-------
 drivers/spi/spi.c    |  3 +++
 5 files changed, 51 insertions(+), 23 deletions(-)

Comments

Greg KH July 30, 2020, 6:54 a.m. UTC | #1
On Wed, Jul 08, 2020 at 03:27:00PM +0200, Lukas Wunner wrote:
> Prevent dynamic SPI device addition below a controller which is
> being removed.  To do so, set the controller's "dead" flag using
> kill_device() (patch [3/3]).

Why is the SPI bus allowing this to happen?  Don't you have a per-bus
lock that can serialize all of this?

thanks,

greg k-h