ANDROID: KVM: arm64: iommu: Fix map_pages() error path

commit "a737b7d0e721 (ANDROID: KVM: arm64: iommu: Reduce the logic in
generic code)" moved map operation including io-pgtable loop to the
driver to remove dependcy on io-pgtable from iommu code.
However, the error path was relying on this loop incrementing paddr
so it can properly undo the rest of the range, luckly we know how
much was mapped so we just need to increment it.

Bug: 277989609
Bug: 278749606

Change-Id: I16183590de51a3989c9f8c699ee6513a5effc90d
Signed-off-by: Mostafa Saleh <smostafa@google.com>
This commit is contained in:
Mostafa Saleh 2024-06-25 08:36:48 +00:00
parent dbc350cb13
commit 65ea117650

View File

@ -331,7 +331,7 @@ size_t kvm_iommu_map_pages(pkvm_handle_t domain_id, unsigned long iova,
* so far.
*/
if (pgcount)
__pkvm_host_unuse_dma(paddr, pgcount * pgsize);
__pkvm_host_unuse_dma(paddr + total_mapped, pgcount * pgsize);
domain_put(domain);
return total_mapped;