diff options
author | Christoph Hellwig | 2020-09-16 18:11:01 -0700 |
---|---|---|
committer | Christoph Hellwig | 2020-09-17 10:36:25 +0200 |
commit | 3a6b076168e20a50289d71f601f1dd02be0f8e88 (patch) | |
tree | a2f312634f5c551b47b71bd28d103cf96ccbe827 /drivers/nvme | |
parent | 52a3974feb1a3eec25d8836d37a508b67b0a9cd0 (diff) |
nvmet: get transport reference for passthru ctrl
Grab a reference to the transport driver to ensure it can't be unloaded
while a passthrough controller is active.
Fixes: c1fef73f793b ("nvmet: add passthru code to process commands")
Reported-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/target/passthru.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c index 8bd7f656e240..dacfa7435d0b 100644 --- a/drivers/nvme/target/passthru.c +++ b/drivers/nvme/target/passthru.c @@ -517,6 +517,7 @@ int nvmet_passthru_ctrl_enable(struct nvmet_subsys *subsys) subsys->ver = NVME_VS(1, 2, 1); } + __module_get(subsys->passthru_ctrl->ops->module); mutex_unlock(&subsys->lock); return 0; @@ -531,6 +532,7 @@ static void __nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys) { if (subsys->passthru_ctrl) { xa_erase(&passthru_subsystems, subsys->passthru_ctrl->cntlid); + module_put(subsys->passthru_ctrl->ops->module); nvme_put_ctrl(subsys->passthru_ctrl); } subsys->passthru_ctrl = NULL; |