summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChayan Biswas <Chayan.Biswas@sandisk.com>2013-05-23 00:34:49 +0200
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2013-05-23 19:38:59 +0200
commitcf90bc4830b858487fe4b9b9ecd0031e23ca3e83 (patch)
treee5ea89c97b8af24a72cb49cdd451a1f536e1cdeb
parentNVMe: Do not cancel command multiple times (diff)
downloadlinux-cf90bc4830b858487fe4b9b9ecd0031e23ca3e83.tar.xz
linux-cf90bc4830b858487fe4b9b9ecd0031e23ca3e83.zip
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: Chayan Biswas <Chayan.Biswas@sandisk.com> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
-rw-r--r--drivers/block/nvme-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 42abf72d3884..84937089d5db 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -1439,7 +1439,7 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev,
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)))
status = -EFAULT;