Commit 97ba0c74 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'iommu-fixes-v5.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pull IOMMU fix from Joerg Roedel:
 "Fix a possible NULL-ptr dereference in dev_iommu_priv_get() which is
  too easy to accidentially trigger from IOMMU drivers.

  In the current case the AMD IOMMU driver triggered it on some machines
  in the IO-page-fault path, so fix it once and for all"

* tag 'iommu-fixes-v5.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu: Check dev->iommu in dev_iommu_priv_get() before dereferencing it
parents e07ce64d 4c9fb5d9
......@@ -616,7 +616,10 @@ static inline void dev_iommu_fwspec_set(struct device *dev,
static inline void *dev_iommu_priv_get(struct device *dev)
{
return dev->iommu->priv;
if (dev->iommu)
return dev->iommu->priv;
else
return NULL;
}
static inline void dev_iommu_priv_set(struct device *dev, void *priv)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment