summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-10-07 08:24:09 -0600
committerJens Axboe <axboe@kernel.dk>2020-10-07 08:24:09 -0600
commite0894cd618e420d7bacebadcd26b7193780332e2 (patch)
treec1e3ffbad33cdc91817066a2974383cf2400a898
parent7370997d48520ad923e8eb4deb59ebf290396202 (diff)
parent4bab69093044ca81f394bd0780be1b71c5a4d308 (diff)
Merge tag 'nvme-5.9-2020-10-07' of git://git.infradead.org/nvme into block-5.9
Pull NVMe fix from Christoph: "nvme fix for 5.9: - fix a recently introduced controller leak (Logan Gunthorpe)" * tag 'nvme-5.9-2020-10-07' of git://git.infradead.org/nvme: nvme-core: put ctrl ref when module ref get fail
-rw-r--r--drivers/nvme/host/core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 53c93836c7c6..ca516d68f14f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3265,8 +3265,10 @@ static int nvme_dev_open(struct inode *inode, struct file *file)
}
nvme_get_ctrl(ctrl);
- if (!try_module_get(ctrl->ops->module))
+ if (!try_module_get(ctrl->ops->module)) {
+ nvme_put_ctrl(ctrl);
return -EINVAL;
+ }
file->private_data = ctrl;
return 0;