ANDROID: KVM: Send FFA_RX_RELEASE with the hyp buffers lock held

Prevent the RX_RELEASE from being issued to Trustzone if the
hypervisor buffers are being used.

Bug: 269285339
Bug: 278749606
Change-Id: I777a6fd467aa622e48c61040eb27b8b8064a6fd4
Signed-off-by: Sebastian Ene <sebastianene@google.com>
This commit is contained in:
Sebastian Ene
2025-04-10 11:51:00 +00:00
parent aa563ed064
commit 81c0fd9e9d
+10
View File
@@ -1158,6 +1158,11 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
case FFA_PARTITION_INFO_GET:
do_ffa_part_get(&res, host_ctxt, NULL);
goto out_handled;
case FFA_RX_RELEASE:
hyp_spin_lock(&kvm_ffa_hyp_lock);
ffa_rx_release(&res);
hyp_spin_unlock(&kvm_ffa_hyp_lock);
goto out_handled;
}
if (ffa_call_supported(func_id))
@@ -1224,6 +1229,11 @@ bool kvm_guest_ffa_handler(struct pkvm_hyp_vcpu *hyp_vcpu, u64 *exit_code)
case FFA_PARTITION_INFO_GET:
do_ffa_part_get(&res, ctxt, hyp_vcpu);
goto out_guest;
case FFA_RX_RELEASE:
hyp_spin_lock(&kvm_ffa_hyp_lock);
ffa_rx_release(&res);
hyp_spin_unlock(&kvm_ffa_hyp_lock);
goto out_guest;
default:
ret = -EOPNOTSUPP;
break;