Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 999ada28 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

nvme: check for a live controller in nvme_dev_open



This is a much more sensible check than just the admin queue.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarSagi Grimberg <sagi@rimbeg.me>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
parent a6a5149b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1891,7 +1891,7 @@ static int nvme_dev_open(struct inode *inode, struct file *file)
	struct nvme_ctrl *ctrl =
		container_of(inode->i_cdev, struct nvme_ctrl, cdev);

	if (!ctrl->admin_q)
	if (ctrl->state != NVME_CTRL_LIVE)
		return -EWOULDBLOCK;
	file->private_data = ctrl;
	return 0;