diff options
author | Tina Zhang <tina.zhang@intel.com> | 2023-04-13 06:06:45 +0200 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2023-04-13 12:05:53 +0200 |
commit | e60d63e32d239c4c20b370106b57079d7f0994cf (patch) | |
tree | 895fa93694e7ce55a3c10558045093726150e200 | |
parent | iommu/vt-d: Remove a useless BUG_ON(dev->is_virtfn) (diff) | |
download | linux-e60d63e32d239c4c20b370106b57079d7f0994cf.tar.xz linux-e60d63e32d239c4c20b370106b57079d7f0994cf.zip |
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 <tina.zhang@intel.com>
Link: https://lore.kernel.org/r/20230406065944.2773296-8-tina.zhang@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/iommu/intel/dmar.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index 9684c96247f8..7eceee081235 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -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; |