Skip to content

Commit e60d63e

Browse files
TinaZhangZWjoergroedel
authored andcommitted
iommu/vt-d: Remove BUG_ON in dmar_insert_dev_scope()
The dmar_insert_dev_scope() could fail if any unexpected condition is encountered. However, in this situation, the kernel should attempt recovery and proceed with execution. Remove BUG_ON with WARN_ON, so that kernel can avoid being crashed when an unexpected condition occurs. Signed-off-by: Tina Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lu Baolu <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent ff45ab9 commit e60d63e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iommu/intel/dmar.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info,
262262
get_device(dev));
263263
return 1;
264264
}
265-
BUG_ON(i >= devices_cnt);
265+
if (WARN_ON(i >= devices_cnt))
266+
return -EINVAL;
266267
}
267268

268269
return 0;

0 commit comments

Comments
 (0)