Skip to content

Commit

Permalink
Return the result from user admin command IOCTL even in case of failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chayan Biswas authored and Matthew Wilcox committed May 23, 2013
1 parent 053ab70 commit cf90bc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/block/nvme-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit cf90bc4

Please sign in to comment.