Return the result from user admin command IOCTL even in case of failure
authorChayan Biswas <Chayan.Biswas@sandisk.com>
Wed, 22 May 2013 22:34:49 +0000 (22:34 +0000)
committerMatthew Wilcox <matthew.r.wilcox@intel.com>
Thu, 23 May 2013 17:38:59 +0000 (13:38 -0400)
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>
drivers/block/nvme-core.c

index 42abf72d388440832d38970f3c5a79c4f07c0452..84937089d5db7f111c99e6a1fe8f9444fffedef3 100644 (file)
@@ -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;
 
This page took 0.028552 seconds and 5 git commands to generate.