Skip to content

Commit f414269

Browse files
Per LarsenMarc Zyngier
authored andcommitted
KVM: arm64: Correct return value on host version downgrade attempt
Once the hypervisor negotiates the FF-A version with the host, it should remain locked-in. However, it is possible to load FF-A as a module first supporting version 1.1 and then 1.0. Without this patch, the FF-A 1.0 driver will use 1.0 data structures to make calls which the hypervisor will incorrectly interpret as 1.1 data structures. With this patch, negotiation will fail. This patch does not change existing functionality in the case where a FF-A 1.2 driver is loaded after a 1.1 driver; the 1.2 driver will need to use 1.1 in order to proceed. Acked-by: Will Deacon <will@kernel.org> Signed-off-by: Per Larsen <perlarsen@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 1b237f1 commit f414269

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • arch/arm64/kvm/hyp/nvhe

arch/arm64/kvm/hyp/nvhe/ffa.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,10 @@ static void do_ffa_version(struct arm_smccc_res *res,
712712

713713
hyp_spin_lock(&version_lock);
714714
if (has_version_negotiated) {
715-
res->a0 = hyp_ffa_version;
715+
if (FFA_MINOR_VERSION(ffa_req_version) < FFA_MINOR_VERSION(hyp_ffa_version))
716+
res->a0 = FFA_RET_NOT_SUPPORTED;
717+
else
718+
res->a0 = hyp_ffa_version;
716719
goto unlock;
717720
}
718721

0 commit comments

Comments
 (0)