summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-02-05 09:57:29 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2021-02-05 09:57:29 -0800
commit97ba0c7413f83ab3b43a5ba05362ecc837fce518 (patch)
treebd0863fd6aa5035c9f2ee50d1c3b3bab575854c6 /include
parente07ce64d83046178c9c0c35e9d230a9b178b62ef (diff)
parent4c9fb5d9140802db4db9f66c23887f43174e113c (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/linux/iommu.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index b3f0e2018c62..efa96263b81b 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -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)