Skip to content

Commit 35dc5d8

Browse files
TinaZhangZWjoergroedel
authored andcommitted
iommu/vt-d: Remove BUG_ON on checking valid pfn range
When encountering an unexpected invalid pfn range, the kernel should attempt recovery and proceed with execution. Therefore, using WARN_ON to replace BUG_ON to avoid halting the machine. Besides, one redundant checking is reduced. Signed-off-by: Tina Zhang <tina.zhang@intel.com> Link: https://lore.kernel.org/r/20230406065944.2773296-3-tina.zhang@intel.com Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent b31064f commit 35dc5d8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/iommu/intel/iommu.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,9 @@ static void dma_pte_clear_range(struct dmar_domain *domain,
10051005
unsigned int large_page;
10061006
struct dma_pte *first_pte, *pte;
10071007

1008-
BUG_ON(!domain_pfn_supported(domain, start_pfn));
1009-
BUG_ON(!domain_pfn_supported(domain, last_pfn));
1010-
BUG_ON(start_pfn > last_pfn);
1008+
if (WARN_ON(!domain_pfn_supported(domain, last_pfn)) ||
1009+
WARN_ON(start_pfn > last_pfn))
1010+
return;
10111011

10121012
/* we don't need lock here; nobody else touches the iova range */
10131013
do {
@@ -1166,9 +1166,9 @@ static void dma_pte_clear_level(struct dmar_domain *domain, int level,
11661166
static void domain_unmap(struct dmar_domain *domain, unsigned long start_pfn,
11671167
unsigned long last_pfn, struct list_head *freelist)
11681168
{
1169-
BUG_ON(!domain_pfn_supported(domain, start_pfn));
1170-
BUG_ON(!domain_pfn_supported(domain, last_pfn));
1171-
BUG_ON(start_pfn > last_pfn);
1169+
if (WARN_ON(!domain_pfn_supported(domain, last_pfn)) ||
1170+
WARN_ON(start_pfn > last_pfn))
1171+
return;
11721172

11731173
/* we don't need lock here; nobody else touches the iova range */
11741174
dma_pte_clear_level(domain, agaw_to_level(domain->agaw),

0 commit comments

Comments
 (0)