diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-02-05 20:57:29 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-02-05 20:57:29 +0300 |
commit | 97ba0c7413f83ab3b43a5ba05362ecc837fce518 (patch) | |
tree | bd0863fd6aa5035c9f2ee50d1c3b3bab575854c6 | |
parent | e07ce64d83046178c9c0c35e9d230a9b178b62ef (diff) | |
parent | 4c9fb5d9140802db4db9f66c23887f43174e113c (diff) | |
download | linux-97ba0c7413f83ab3b43a5ba05362ecc837fce518.tar.xz |
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
-rw-r--r-- | include/linux/iommu.h | 5 |
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) |