Skip to content

Commit c56cba5

Browse files
LuBaolujoergroedel
authored andcommitted
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: 2f26e0a ("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>
1 parent 41b80db commit c56cba5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/intel-svm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
234234
int pasid_max;
235235
int ret;
236236

237-
if (!iommu)
237+
if (!iommu || dmar_disabled)
238238
return -EINVAL;
239239

240240
if (dev_is_pci(dev)) {

0 commit comments

Comments
 (0)