[PATCH 1/2] nvme-pci: Fix multiple races in nvme_setup_io_queues()
Keith Busch
kbusch at kernel.org
Tue Jun 22 08:06:36 PDT 2021
On Mon, Jun 21, 2021 at 05:27:09PM -0700, Casey Chen wrote:
> + /*
> + * Free IRQ resources as soon as NVMEQ_ENABLED bit transitions
> + * from set to unset. If there is a window to it is truely freed,
> + * pci_free_irq_vectors() jumping into this window will crash.
> + * And take lock to avoid racing with pci_free_irq_vectors() in
> + * nvme_dev_disable() path.
> + */
> + mutex_lock(&dev->shutdown_lock)
Sorry, I wasn't clear in previous review. All of the shutdown_locks
taken after initialization need to by mutex_trylock()'s. If you have to
wait to get the lock, the device is not going to be suitable for
continuing initialization after the lock is available.
And looking at this again, if trylock is successful, I think you need to
verify controller state is suitable for continuing the initialization.
More information about the Linux-nvme
mailing list