+19
−30
Loading
Sashiko noticed a latent bug where the map error flow called iommu_unmap() which calls iommu_debug_unmap_begin()/iommu_debug_unmap_end() however since this is an error path the map flow never actually established the original iommu_debug_map() it will malfunction. Lift the unmap error handling into iommu_map_nosync() and reorder it so the trace_map()/iommu_debug_map() records the partial mapping and then immediately unmaps it. This avoid creating the unbalanced tracking and provides saner tracing instead of a unmap unmatched to any map. Fixes: ccc21213 ("iommu: Add calls for IOMMU_DEBUG_PAGEALLOC") Signed-off-by:Jason Gunthorpe <jgg@nvidia.com> Reviewed-by:
Pranjal Shrivastava <praan@google.com> Reviewed-by:
Samiullah Khawaja <skhawaja@google.com> Reviewed-by:
Mostafa Saleh <smostafa@google.com> Tested-by:
Josua Mayer <josua@solid-run.com> Signed-off-by:
Joerg Roedel <joerg.roedel@amd.com>