Re: [PATCH] NVMe: fix deadlock on failure branch in nvme_get_ns_from_disk()

2016-05-20 Thread Keith Busch
On Sat, May 21, 2016 at 01:36:00AM +0300, Alexey Khoroshilov wrote: > kref_put(&ns->kref, nvme_free_ns) is called in nvme_get_ns_from_disk() > under dev_list_lock spinlock, while nvme_free_ns() locks the spinlock > by itself. This can lead to a deadlock. > > The patch moves try_module_get() and it

[PATCH] NVMe: fix deadlock on failure branch in nvme_get_ns_from_disk()

2016-05-20 Thread Alexey Khoroshilov
kref_put(&ns->kref, nvme_free_ns) is called in nvme_get_ns_from_disk() under dev_list_lock spinlock, while nvme_free_ns() locks the spinlock by itself. This can lead to a deadlock. The patch moves try_module_get() and its error handling out of spinlock section. Found by Linux Driver Verification