Skip to content

Commit 3a6b076

Browse files
author
Christoph Hellwig
committed
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: c1fef73 ("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>
1 parent 52a3974 commit 3a6b076

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/nvme/target/passthru.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ int nvmet_passthru_ctrl_enable(struct nvmet_subsys *subsys)
517517
subsys->ver = NVME_VS(1, 2, 1);
518518
}
519519

520+
__module_get(subsys->passthru_ctrl->ops->module);
520521
mutex_unlock(&subsys->lock);
521522
return 0;
522523

@@ -531,6 +532,7 @@ static void __nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys)
531532
{
532533
if (subsys->passthru_ctrl) {
533534
xa_erase(&passthru_subsystems, subsys->passthru_ctrl->cntlid);
535+
module_put(subsys->passthru_ctrl->ops->module);
534536
nvme_put_ctrl(subsys->passthru_ctrl);
535537
}
536538
subsys->passthru_ctrl = NULL;

0 commit comments

Comments
 (0)