Re: [PATCH for-4,5] mips/kvm: fix ioctl error handling

From: Sergei Shtylyov
Date: Sun Feb 28 2016 - 12:36:07 EST


Hello.

On 02/28/2016 06:35 PM, Michael S. Tsirkin wrote:

Calling return copy_to_user(...) or return copy_from_user in an ioctl

Calling return? Perhaps "returning the result of"?

will not do the right thing if there's a pagefault:
copy_to_user/copy_from_user return the number of bytes not copied in
this case.

Fix up kvm on mips to do
return copy_to_user(...)) ? -EFAULT : 0;
and
return copy_from_user(...)) ? -EFAULT : 0;

everywhere.

Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
[...]

MBR, Sergei