]> git.baikalelectronics.ru Git - kernel.git/commit
nvme-fabrics: protect against module unload during create_ctrl
authorRoy Shterman <roys@lightbitslabs.com>
Mon, 25 Dec 2017 12:18:30 +0000 (14:18 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 8 Jan 2018 10:01:56 +0000 (11:01 +0100)
commit5055a4379fe65d6f9ac74f204e448a8868a43569
tree3238baff9012d5248e023446cb71dbfafbe77821
parent721e10bd80bff24a10724e00ddcb6d605ce94d9c
nvme-fabrics: protect against module unload during create_ctrl

NVMe transport driver module unload may (and usually does) trigger
iteration over the active controllers and delete them all (sometimes
under a mutex).  However, a controller can be created concurrently with
module unload which can lead to leakage of resources (most important char
device node leakage) in case the controller creation occured after the
unload delete and drain sequence.  To protect against this, we take a
module reference to guarantee that the nvme transport driver is not
unloaded while creating a controller.

Signed-off-by: Roy Shterman <roys@lightbitslabs.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/fabrics.c
drivers/nvme/host/fabrics.h
drivers/nvme/host/fc.c
drivers/nvme/host/rdma.c
drivers/nvme/target/loop.c