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

Matthew Wilcox willy at linux.intel.com
Wed May 22 16:23:41 EDT 2013


On Fri, Mar 01, 2013 at 03:05:06PM -0700, Keith Busch wrote:
> 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.

Going back through my old patches ... Chayan, do you want to make the
change Keith suggested and resubmit?  Or do you think he's wrong?



More information about the Linux-nvme mailing list