]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mips/kvm: fix ioctl error handling
authorMichael S. Tsirkin <mst@redhat.com>
Sun, 28 Feb 2016 15:35:59 +0000 (17:35 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 2 Mar 2016 09:34:52 +0000 (10:34 +0100)
commit0178fd7dcc4451fcb90bec5e91226586962478d2
treeb43c852aa32cdb4f1c2377225d005576cc9c945c
parent2b097e9bc3742d4ffc63fe64b8fd44242d662392
mips/kvm: fix ioctl error handling

Returning directly whatever copy_to_user(...) or copy_from_user(...)
returns may 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, but ioctls need to return -EFAULT instead.

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

everywhere.

Cc: stable@vger.kernel.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/mips/kvm/mips.c