[PATCH V3 1/3] nvme-core: get/put ctrl in nvme_dev_open/release()
Chaitanya Kulkarni
chaitanya.kulkarni at wdc.com
Wed Sep 16 21:11:00 EDT 2020
Get and put the reference to the ctrl in the nvme_dev_open() and
nvme_dev_release() before and after module get/put for ctrl in char
device file operations.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
drivers/nvme/host/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c5f9d64b2bec..c013eb52fdc8 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3261,6 +3261,7 @@ static int nvme_dev_open(struct inode *inode, struct file *file)
return -EWOULDBLOCK;
}
+ nvme_get_ctrl(ctrl);
if (!try_module_get(ctrl->ops->module))
return -EINVAL;
@@ -3274,6 +3275,7 @@ static int nvme_dev_release(struct inode *inode, struct file *file)
container_of(inode->i_cdev, struct nvme_ctrl, cdev);
module_put(ctrl->ops->module);
+ nvme_put_ctrl(ctrl);
return 0;
}
--
2.22.1
More information about the Linux-nvme
mailing list