提交 cf90bc48 编写于 作者: C Chayan Biswas 提交者: Matthew Wilcox

Return the result from user admin command IOCTL even in case of failure

We copy the result to user if the command is completed from the
controller even if it completes with failure (non-zero) status.
A return status of < 0 indicates the command was not completed
by the controller. The user application may expect the error code
in the result field in case of failure.
Signed-off-by: NChayan Biswas <Chayan.Biswas@sandisk.com>
Signed-off-by: NMatthew Wilcox <matthew.r.wilcox@intel.com>
上级 053ab702
...@@ -1439,7 +1439,7 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev, ...@@ -1439,7 +1439,7 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev,
nvme_free_iod(dev, iod); nvme_free_iod(dev, iod);
} }
if (!status && copy_to_user(&ucmd->result, &cmd.result, if ((status >= 0) && copy_to_user(&ucmd->result, &cmd.result,
sizeof(cmd.result))) sizeof(cmd.result)))
status = -EFAULT; status = -EFAULT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册