iommu/vt-d: call __dmar_remove_one_dev_info with valid pointer
Subsystems (2)
PATCH 1/1 iommu/vt-d: call __dmar_remove_one_dev_info with valid pointer
It is possible for archdata.iommu to be set to DEFER_DEVICE_DOMAIN_INFO or DUMMY_DEVICE_DOMAIN_INFO so check for those values before calling __dmar_remove_one_dev_info. Without a check it can result in a null pointer dereference. This has been seen while booting a kdump kernel on an HP dl380 gen9.
Cc Joerg Roedel <[email protected]>
Cc Lu Baolu <[email protected]>
Cc David Woodhouse <[email protected]>
Cc [email protected] # 5.3+
Fixes ae23bfb68f28 ("iommu/vt-d: Detach domain before using a private one")
Signed-off-by Jerry Snitselaar <[email protected]>
--- drivers/iommu/intel-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +2 -1
@@ -5163,7 +5163,8 @@ static void dmar_remove_one_dev_info(struct device *dev)spin_lock_irqsave (&device_domain_lock, flags); info = dev->archdata.iommu; -if (info) +if (info && info !=DEFER_DEVICE_DOMAIN_INFO + && info !=DUMMY_DEVICE_DOMAIN_INFO )__dmar_remove_one_dev_info (info);spin_unlock_irqrestore (&device_domain_lock, flags); }
Signature · 1 line
2.24.0
Quoted 6 lines · Jerry Snitselaar
It is possible for archdata.iommu to be set to
DEFER_DEVICE_DOMAIN_INFOorDUMMY_DEVICE_DOMAIN_INFOso check for those values before calling__dmar_remove_one_dev_info. Without a check it can result in a null pointer dereference. This has been seen while booting a kdump kernel on an HP dl380 gen9.
Quoted 7 lines
Cc Joerg Roedel <[email protected]>Cc Lu Baolu <[email protected]>Cc David Woodhouse <[email protected]>Cc [email protected] # 5.3+Fixes ae23bfb68f28 ("iommu/vt-d: Detach domain before using a private one")Signed-off-by Jerry Snitselaar <[email protected]>
Acked-by Lu Baolu <[email protected]>
Best regards,
baolu