Patch "iommu/vt-d: Fix checks and print in pgtable_walk()" has been added to the 6.1-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/vt-d: Fix checks and print in pgtable_walk()

to the 6.1-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-vt-d-fix-checks-and-print-in-pgtable_walk.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 41be070c85da74599794cbb9d7c6ab3b01e424cd
Author: Zhenzhong Duan <zhenzhong.duan@xxxxxxxxx>
Date:   Mon Nov 4 09:40:33 2024 +0800

    iommu/vt-d: Fix checks and print in pgtable_walk()
    
    [ Upstream commit f1645676f25d2c846798f0233c3a953efd62aafb ]
    
    There are some issues in pgtable_walk():
    
    1. Super page is dumped as non-present page
    2. dma_pte_superpage() should not check against leaf page table entries
    3. Pointer pte is never NULL so checking it is meaningless
    4. When an entry is not present, it still makes sense to dump the entry
       content.
    
    Fix 1,2 by checking dma_pte_superpage()'s returned value after level check.
    Fix 3 by removing pte check.
    Fix 4 by checking present bit after printing.
    
    By this chance, change to print "page table not present" instead of "PTE
    not present" to be clearer.
    
    Fixes: 914ff7719e8a ("iommu/vt-d: Dump DMAR translation structure when DMA fault occurs")
    Signed-off-by: Zhenzhong Duan <zhenzhong.duan@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20241024092146.715063-3-zhenzhong.duan@xxxxxxxxx
    Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
    Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 2bf9157256c55..9a1bdfda9a9af 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -831,14 +831,15 @@ static void pgtable_walk(struct intel_iommu *iommu, unsigned long pfn,
 	while (1) {
 		offset = pfn_level_offset(pfn, level);
 		pte = &parent[offset];
-		if (!pte || (dma_pte_superpage(pte) || !dma_pte_present(pte))) {
-			pr_info("PTE not present at level %d\n", level);
-			break;
-		}
 
 		pr_info("pte level: %d, pte value: 0x%016llx\n", level, pte->val);
 
-		if (level == 1)
+		if (!dma_pte_present(pte)) {
+			pr_info("page table not present at level %d\n", level - 1);
+			break;
+		}
+
+		if (level == 1 || dma_pte_superpage(pte))
 			break;
 
 		parent = phys_to_virt(dma_pte_addr(pte));




[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