Skip to content

Commit 0496acc

Browse files
Zenghui Yu (Huawei)Marc Zyngier
authored andcommitted
KVM: arm64: Fix the descriptor address in __kvm_at_swap_desc()
Using "(u64 __user *)hva + offset" to get the virtual addresses of S1/S2 descriptors looks really wrong, if offset is not zero. What we want to get for swapping is hva + offset, not hva + offset*8. ;-) Fix it. Fixes: f6927b4 ("KVM: arm64: Add helper for swapping guest descriptor") Signed-off-by: Zenghui Yu (Huawei) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Marc Zyngier <[email protected]> Cc: [email protected]
1 parent 1744a6e commit 0496acc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/arm64/kvm/at.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,7 @@ int __kvm_at_swap_desc(struct kvm *kvm, gpa_t ipa, u64 old, u64 new)
17531753
if (!writable)
17541754
return -EPERM;
17551755

1756-
ptep = (u64 __user *)hva + offset;
1756+
ptep = (void __user *)hva + offset;
17571757
if (cpus_have_final_cap(ARM64_HAS_LSE_ATOMICS))
17581758
r = __lse_swap_desc(ptep, old, new);
17591759
else

0 commit comments

Comments
 (0)