[PATCH 2/2] Return the result from user admin command IOCTL even in case of failureX

Keith Busch keith.busch at intel.com
Fri Mar 1 17:05:06 EST 2013


On Thu, 28 Feb 2013, Chayan Biswas wrote:
> -       if (!status && copy_to_user(&ucmd->result, &cmd.result,
> -                                                       sizeof(cmd.result)))
> +       if (copy_to_user(&ucmd->result, &cmd.result, sizeof(cmd.result)))
>                status = -EFAULT;

I think you want to change this to a check for 'status >= 0' before
copying the result to the user since a status < 0 means the command was
not completed by the controller (successfully or otherwise) and you'd
be copying uninitialized data to the user in that case.



More information about the Linux-nvme mailing list