From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org,
will@kernel.org, robin.murphy@arm.com, chao.p.peng@intel.com,
Zhenzhong Duan <zhenzhong.duan@intel.com>,
Kyung Min Park <kyung.min.park@intel.com>
Subject: [PATCH 2/2] iommu/vt-d: Fix checks in pgtable_walk()
Date: Tue, 22 Oct 2024 17:50:17 +0800 [thread overview]
Message-ID: <20241022095017.479081-3-zhenzhong.duan@intel.com> (raw)
In-Reply-To: <20241022095017.479081-1-zhenzhong.duan@intel.com>
It's not accurate to dump super page as non-present page,
meanwhile bit7 in first level page table entry is PAT bit,
also pointer pte is never NULL in pgtable_walk() context.
Fixes: 914ff7719e8a ("iommu/vt-d: Dump DMAR translation structure when DMA fault occurs")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
drivers/iommu/intel/iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 8288b0ee7a61..fec5cc1147f3 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -707,14 +707,14 @@ 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))) {
+ if (!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 (level == 1 || dma_pte_superpage(pte))
break;
parent = phys_to_virt(dma_pte_addr(pte));
--
2.34.1
next prev parent reply other threads:[~2024-10-22 9:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 9:50 [PATCH 0/2] vtd: Minor cleanup Zhenzhong Duan
2024-10-22 9:50 ` [PATCH 1/2] iommu/vt-d: Fix checks in dmar_fault_dump_ptes() Zhenzhong Duan
2024-10-23 3:12 ` Baolu Lu
2024-10-23 5:09 ` Duan, Zhenzhong
2024-10-23 7:37 ` Baolu Lu
2024-10-22 9:50 ` Zhenzhong Duan [this message]
2024-10-23 4:49 ` [PATCH 2/2] iommu/vt-d: Fix checks in pgtable_walk() Baolu Lu
2024-10-23 5:16 ` Duan, Zhenzhong
2024-10-23 7:41 ` Baolu Lu
2024-10-23 7:48 ` Duan, Zhenzhong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241022095017.479081-3-zhenzhong.duan@intel.com \
--to=zhenzhong.duan@intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=chao.p.peng@intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kyung.min.park@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®