diff options
authorJames Smart <>2017-06-15 23:40:54 -0700
committerJens Axboe <>2017-06-28 08:14:13 -0600
commit0b5a7669a457dd503b3d9922e931ecb01843a916 (patch)
parent36715cf4b36688aa327d77ddb6bc5f740b01de94 (diff)
nvme_fc: Fix crash when nvme controller connection fails.
If a controller connection is attempted (say to a subsystem that does not exist), the first attempt errors out. If another connect is attempted, it crashes. Issue is the prior controller has yet execute it's final put, thus its still on lists. However, opts points on it have been cleared, thus causing the crash if they are referenced. Fix is to add the missing put after the nvme_uninit_ctrl() call on the attachment failure. Signed-off-by: Paul Ely <> Signed-off-by: James Smart <> Signed-off-by: Sagi Grimberg <> Signed-off-by: Jens Axboe <>
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index cdd138c1f223..9444495343ac 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -2764,6 +2764,9 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
+ /* Remove core ctrl ref. */
+ nvme_put_ctrl(&ctrl->ctrl);
/* as we're past the point where we transition to the ref
* counting teardown path, if we return a bad pointer here,
* the calling routine, thinking it's prior to the