Skip to content

Commit

Permalink
iommu/vt-d: Remove BUG_ON in dmar_insert_dev_scope()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
TinaZhangZW authored and joergroedel committed Apr 13, 2023
1 parent ff45ab9 commit e60d63e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iommu/intel/dmar.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info,
get_device(dev));
return 1;
}
BUG_ON(i >= devices_cnt);
if (WARN_ON(i >= devices_cnt))
return -EINVAL;
}

return 0;
Expand Down

0 comments on commit e60d63e

Please sign in to comment.