diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index 6b1e0ac5762e..25d04d63f7b7 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -609,6 +609,7 @@ static int __do_ffa_mem_xfer(const u64 func_id, u32 offset, nr_ranges; int ret = 0; struct ffa_mem_transfer *transfer = NULL; + u64 ffa_handle; if (addr_mbz || npages_mbz || fraglen > len || fraglen > KVM_FFA_MBOX_NR_PAGES * PAGE_SIZE) { @@ -716,12 +717,16 @@ static int __do_ffa_mem_xfer(const u64 func_id, if (res->a3 != fraglen) goto err_unshare; - } else if (res->a0 != FFA_SUCCESS) { + + ffa_handle = PACK_HANDLE(res->a1, res->a2); + } else if (res->a0 == FFA_SUCCESS) { + ffa_handle = PACK_HANDLE(res->a2, res->a3); + } else { goto err_unshare; } if (hyp_vcpu && transfer) { - transfer->ffa_handle = PACK_HANDLE(res->a2, res->a3); + transfer->ffa_handle = ffa_handle; list_add(&transfer->node, &ffa_buf->xfer_list); }