]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: PPC: Book3S: Fix incorrect guest-to-user-translation error handling
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Mon, 26 Aug 2019 04:55:20 +0000 (14:55 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Sep 2019 08:23:41 +0000 (10:23 +0200)
commitd69ebe85e16908698844c40f08d3d1dba417405c
tree6935bbffa9a3e74380b791ea038d88b98f4f9b09
parent3698cd854f436b02ca2db6cf1a8d5a0221dcb03d
KVM: PPC: Book3S: Fix incorrect guest-to-user-translation error handling

commit ddfd151f3def9258397fcde7a372205a2d661903 upstream.

H_PUT_TCE_INDIRECT handlers receive a page with up to 512 TCEs from
a guest. Although we verify correctness of TCEs before we do anything
with the existing tables, there is a small window when a check in
kvmppc_tce_validate might pass and right after that the guest alters
the page of TCEs, causing an early exit from the handler and leaving
srcu_read_lock(&vcpu->kvm->srcu) (virtual mode) or lock_rmap(rmap)
(real mode) locked.

This fixes the bug by jumping to the common exit code with an appropriate
unlock.

Cc: stable@vger.kernel.org # v4.11+
Fixes: 121f80ba68f1 ("KVM: PPC: VFIO: Add in-kernel acceleration for VFIO")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kvm/book3s_64_vio.c
arch/powerpc/kvm/book3s_64_vio_hv.c