iommu/amd: Free domain ID after domain_flush_pages
authorVasant Hegde <vasant.hegde@amd.com>
Mon, 12 Sep 2022 06:32:46 +0000 (06:32 +0000)
committerJoerg Roedel <jroedel@suse.de>
Mon, 26 Sep 2022 11:26:39 +0000 (13:26 +0200)
free_io_pgtable_ops() path uses domain ID to flush pages. Hence
free domain ID after flushing everything.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Link: https://lore.kernel.org/r/20220912063248.7909-4-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/iommu.c

index c55f4a129b1e2614ce00b564d180c69c106235b6..00d0f23b0c0a68ac07b50b697c31625a8bf0ac62 100644 (file)
@@ -2004,12 +2004,12 @@ static void protection_domain_free(struct protection_domain *domain)
        if (!domain)
                return;
 
-       if (domain->id)
-               domain_id_free(domain->id);
-
        if (domain->iop.pgtbl_cfg.tlb)
                free_io_pgtable_ops(&domain->iop.iop.ops);
 
+       if (domain->id)
+               domain_id_free(domain->id);
+
        kfree(domain);
 }