diff options
| author | Lu Baolu <baolu.lu@linux.intel.com> | 2019-02-28 22:23:12 -0500 |
|---|---|---|
| committer | Joerg Roedel <jroedel@suse.de> | 2019-03-01 04:23:36 -0500 |
| commit | c56cba5daf45d2d091ef1cfe2f1d6a930446687b (patch) | |
| tree | 47f66dd725c73e2032239bddf808e87c6bdaff6c | |
| parent | 41b80db227993394f210f0eb705a326db5f605b6 (diff) | |
iommu/vt-d: Fix NULL pointer reference in intel_svm_bind_mm()
Intel IOMMU could be turned off with intel_iommu=off. If Intel
IOMMU is off, the intel_iommu struct will not be initialized.
When device drivers call intel_svm_bind_mm(), the NULL pointer
reference will happen there.
Add dmar_disabled check to avoid NULL pointer reference.
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Reported-by: Dave Jiang <dave.jiang@intel.com>
Fixes: 2f26e0a9c9860 ("iommu/vt-d: Add basic SVM PASID support")
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
| -rw-r--r-- | drivers/iommu/intel-svm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index c79540deaf00..3a4b09ae8561 100644 --- a/drivers/iommu/intel-svm.c +++ b/drivers/iommu/intel-svm.c | |||
| @@ -234,7 +234,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ | |||
| 234 | int pasid_max; | 234 | int pasid_max; |
| 235 | int ret; | 235 | int ret; |
| 236 | 236 | ||
| 237 | if (!iommu) | 237 | if (!iommu || dmar_disabled) |
| 238 | return -EINVAL; | 238 | return -EINVAL; |
| 239 | 239 | ||
| 240 | if (dev_is_pci(dev)) { | 240 | if (dev_is_pci(dev)) { |
