* [PATCH] iommu/vt-d: call __dmar_remove_one_dev_info with valid pointer
@ 2020-01-22 0:34 Jerry Snitselaar
2020-01-22 5:43 ` Lu Baolu
0 siblings, 1 reply; 2+ messages in thread
From: Jerry Snitselaar @ 2020-01-22 0:34 UTC (permalink / raw)
To: iommu; +Cc: David Woodhouse, linux-kernel, stable
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 <joro@8bytes.org>
Cc: Lu Baolu <baolu.lu@linux.intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: stable@vger.kernel.org # 5.3+
Cc: linux-kernel@vger.kernel.org
Fixes: ae23bfb68f28 ("iommu/vt-d: Detach domain before using a private one")
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
drivers/iommu/intel-iommu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 1801f0aaf013..932267f49f9a 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -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);
}
--
2.24.0
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iommu/vt-d: call __dmar_remove_one_dev_info with valid pointer
2020-01-22 0:34 [PATCH] iommu/vt-d: call __dmar_remove_one_dev_info with valid pointer Jerry Snitselaar
@ 2020-01-22 5:43 ` Lu Baolu
0 siblings, 0 replies; 2+ messages in thread
From: Lu Baolu @ 2020-01-22 5:43 UTC (permalink / raw)
To: Jerry Snitselaar, iommu; +Cc: David Woodhouse, linux-kernel, stable
On 1/22/20 8:34 AM, Jerry Snitselaar wrote:
> 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 <joro@8bytes.org>
> Cc: Lu Baolu <baolu.lu@linux.intel.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: stable@vger.kernel.org # 5.3+
> Cc: linux-kernel@vger.kernel.org
> Fixes: ae23bfb68f28 ("iommu/vt-d: Detach domain before using a private one")
> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Best regards,
baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-22 5:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22 0:34 [PATCH] iommu/vt-d: call __dmar_remove_one_dev_info with valid pointer Jerry Snitselaar
2020-01-22 5:43 ` Lu Baolu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).