Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c56cba5d authored by Lu Baolu's avatar Lu Baolu Committed by Joerg Roedel
Browse files

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: default avatarDave Jiang <dave.jiang@intel.com>
Fixes: 2f26e0a9 ("iommu/vt-d: Add basic SVM PASID support")
Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 41b80db2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -234,7 +234,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
	int pasid_max;
	int ret;

	if (!iommu)
	if (!iommu || dmar_disabled)
		return -EINVAL;

	if (dev_is_pci(dev)) {