arm/arm64: KVM: Fix ioctl error handling
authorMichael S. Tsirkin <mst@redhat.com>
Sun, 28 Feb 2016 15:32:07 +0000 (17:32 +0200)
committerSasha Levin <sasha.levin@oracle.com>
Wed, 9 Mar 2016 18:15:17 +0000 (13:15 -0500)
commit222b341c1063cb7aa497d7ed051ccb60349f54bb
treefd7977be23924cacaff703e9a14cd8efdd2d4b74
parent092bb6bd432857cde601ab6f2716ef313f6f7023
arm/arm64: KVM: Fix ioctl error handling

[ Upstream commit 4cad67fca3fc952d6f2ed9e799621f07666a560f ]

Calling return copy_to_user(...) in an ioctl will not
do the right thing if there's a pagefault:
copy_to_user returns the number of bytes not copied
in this case.

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

everywhere.

Cc: stable@vger.kernel.org
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
arch/arm/kvm/guest.c
arch/arm64/kvm/guest.c