Patch "iommu/amd: Fix I/O page table memory leak" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iommu/amd: Fix I/O page table memory leak

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iommu-amd-fix-i-o-page-table-memory-leak.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7656e2f87a4d5b925445c4ede4ceae460151c4bc
Author: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
Date:   Thu Feb 10 09:47:45 2022 -0600

    iommu/amd: Fix I/O page table memory leak
    
    [ Upstream commit 6b0b2d9a6a308bcd9300c2d83000a82812c56cea ]
    
    The current logic updates the I/O page table mode for the domain
    before calling the logic to free memory used for the page table.
    This results in IOMMU page table memory leak, and can be observed
    when launching VM w/ pass-through devices.
    
    Fix by freeing the memory used for page table before updating the mode.
    
    Cc: Joerg Roedel <joro@xxxxxxxxxx>
    Reported-by: Daniel Jordan <daniel.m.jordan@xxxxxxxxxx>
    Tested-by: Daniel Jordan <daniel.m.jordan@xxxxxxxxxx>
    Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
    Fixes: e42ba0633064 ("iommu/amd: Restructure code for freeing page table")
    Link: https://lore.kernel.org/all/20220118194720.urjgi73b7c3tq2o6@xxxxxxxxxx/
    Link: https://lore.kernel.org/r/20220210154745.11524-1-suravee.suthikulpanit@xxxxxxx
    Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/amd/io_pgtable.c b/drivers/iommu/amd/io_pgtable.c
index b1bf4125b0f7..6608d1717574 100644
--- a/drivers/iommu/amd/io_pgtable.c
+++ b/drivers/iommu/amd/io_pgtable.c
@@ -492,18 +492,18 @@ static void v1_free_pgtable(struct io_pgtable *iop)
 
 	dom = container_of(pgtable, struct protection_domain, iop);
 
-	/* Update data structure */
-	amd_iommu_domain_clr_pt_root(dom);
-
-	/* Make changes visible to IOMMUs */
-	amd_iommu_domain_update(dom);
-
 	/* Page-table is not visible to IOMMU anymore, so free it */
 	BUG_ON(pgtable->mode < PAGE_MODE_NONE ||
 	       pgtable->mode > PAGE_MODE_6_LEVEL);
 
 	free_sub_pt(pgtable->root, pgtable->mode, &freelist);
 
+	/* Update data structure */
+	amd_iommu_domain_clr_pt_root(dom);
+
+	/* Make changes visible to IOMMUs */
+	amd_iommu_domain_update(dom);
+
 	put_pages_list(&freelist);
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux