ANDROID: KVM: Reset the free ffa handle entry

When kvm-arm.ffa-unmap-on-lend is used,
clearing an ff-a handle from the list keeps
an address pointing to the free object. Once
we make use of that object in a sub-sequent
allocation make sure that wwe clear the free
reference.

Bug: 430896873
Change-Id: I4e707d4c692e190292103ad56ce5dba16cabd5af
Signed-off-by: Sebastian Ene <sebastianene@google.com>
This commit is contained in:
Sebastian Ene
2025-08-08 08:49:44 +00:00
parent 0d89690c20
commit 9fbae8cca4
+4 -2
View File
@@ -121,9 +121,11 @@ static int ffa_host_store_handle(u64 ffa_handle, bool is_lend)
if (!static_branch_unlikely(&kvm_ffa_unmap_on_lend))
return 0;
if (spm_free_handle >= spm_handles &&
spm_free_handle < (spm_handles + num_spm_handles)) {
if (spm_free_handle) {
WARN_ON(spm_free_handle < spm_handles ||
spm_free_handle >= (spm_handles + num_spm_handles));
free_handle = spm_free_handle;
spm_free_handle = NULL;
} else {
for (i = 0; i < num_spm_handles; i++)
if (spm_handles[i].handle == FFA_INVALID_SPM_HANDLE)