diff options
author | Roy Shterman <roys@lightbitslabs.com> | 2017-12-25 13:18:30 +0100 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-01-08 11:01:56 +0100 |
commit | 0de5cd367c6aa2a31a1c931628f778f79f8ef22e (patch) | |
tree | 3238baff9012d5248e023446cb71dbfafbe77821 /drivers/nvme/host/fabrics.h | |
parent | nvmet-fc: cleanup nvmet add_port/remove_port (diff) | |
download | linux-0de5cd367c6aa2a31a1c931628f778f79f8ef22e.tar.xz linux-0de5cd367c6aa2a31a1c931628f778f79f8ef22e.zip |
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>
Diffstat (limited to 'drivers/nvme/host/fabrics.h')
-rw-r--r-- | drivers/nvme/host/fabrics.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h index 9ba614953607..25b19f722f5b 100644 --- a/drivers/nvme/host/fabrics.h +++ b/drivers/nvme/host/fabrics.h @@ -108,6 +108,7 @@ struct nvmf_ctrl_options { * fabric implementation of NVMe fabrics. * @entry: Used by the fabrics library to add the new * registration entry to its linked-list internal tree. + * @module: Transport module reference * @name: Name of the NVMe fabric driver implementation. * @required_opts: sysfs command-line options that must be specified * when adding a new NVMe controller. @@ -126,6 +127,7 @@ struct nvmf_ctrl_options { */ struct nvmf_transport_ops { struct list_head entry; + struct module *module; const char *name; int required_opts; int allowed_opts; |