File 611f844b-AMD-IOMMU-dont-leave-pt-mapped.patch of Package xen.31431

# Commit 3cfec6a6aa7a7bf68f8e19e21f450c2febe9acb4
# Date 2021-08-20 12:30:35 +0200
# Author Jan Beulich <jbeulich@suse.com>
# Committer Jan Beulich <jbeulich@suse.com>
AMD/IOMMU: don't leave page table mapped when unmapping ...

... an already not mapped page. With all other exit paths doing the
unmap, I have no idea how I managed to miss that aspect at the time.

Fixes: ad591454f069 ("AMD/IOMMU: don't needlessly trigger errors/crashes when unmapping a page")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>

--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -442,7 +442,10 @@ static int iommu_pde_from_dfn(struct dom
         else if ( !iommu_is_pte_present((uint32_t *)pde) )
         {
             if ( !map )
+            {
+                unmap_domain_page(next_table_vaddr);
                 return 0;
+            }
 
             if ( next_table_mfn == 0 )
             {
openSUSE Build Service is sponsored by