[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 8 Aug 2017 13:22:19 -0700
From: Ashok Raj <ashok.raj@...el.com>
To: linux-kernel@...r.kernel.org, Joerg Roedel <joro@...tes.org>
Cc: Ashok Raj <ashok.raj@...el.com>, Huang Ying <ying.huang@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
iommu@...ts-foundation.org, David Woodhouse <dwmw2@...radead.org>,
Jacob Pan <jacob.jun.pan@...el.com>
Subject: [PATCH 2/4] iommu/vt-d: Avoid calling virt_to_phys() on null pointer
New kernels with debug show panic() from __phys_addr() checks. Avoid
calling virt_to_phys() when pasid_state_tbl pointer is null
To: Joerg Roedel <joro@...tes.org>
To: linux-kernel@...r.kernel.org>
Cc: iommu@...ts-foundation.org
Cc: David Woodhouse <dwmw2@...radead.org>
Cc: Jacob Pan <jacob.jun.pan@...el.com>
Cc: Ashok Raj <ashok.raj@...el.com>
Signed-off-by: Ashok Raj <ashok.raj@...el.com>
---
drivers/iommu/intel-iommu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 687f18f..5c6118d 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -5341,7 +5341,8 @@ int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sd
sdev->sid = PCI_DEVID(info->bus, info->devfn);
if (!(ctx_lo & CONTEXT_PASIDE)) {
- context[1].hi = (u64)virt_to_phys(iommu->pasid_state_table);
+ if (iommu->pasid_state_table)
+ context[1].hi = (u64)virt_to_phys(iommu->pasid_state_table);
context[1].lo = (u64)virt_to_phys(iommu->pasid_table) |
intel_iommu_get_pts(iommu);
--
2.7.4
Powered by blists - more mailing lists