Skip to content

Commit 60f030f

Browse files
keestuxjoergroedel
authored andcommitted
iommu/vt-d: Avoid use of NULL after WARN_ON_ONCE
There is a WARN_ON_ONCE to catch an unlikely situation when domain_remove_dev_pasid can't find the `pasid`. In case it nevertheless happens we must avoid using a NULL pointer. Signed-off-by: Kees Bakker <kees@ijzerbout.nl> Link: https://lore.kernel.org/r/20241218201048.E544818E57E@bout3.ijzerbout.nl Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 78d4f34 commit 60f030f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/iommu/intel/iommu.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4090,13 +4090,14 @@ void domain_remove_dev_pasid(struct iommu_domain *domain,
40904090
break;
40914091
}
40924092
}
4093-
WARN_ON_ONCE(!dev_pasid);
40944093
spin_unlock_irqrestore(&dmar_domain->lock, flags);
40954094

40964095
cache_tag_unassign_domain(dmar_domain, dev, pasid);
40974096
domain_detach_iommu(dmar_domain, iommu);
4098-
intel_iommu_debugfs_remove_dev_pasid(dev_pasid);
4099-
kfree(dev_pasid);
4097+
if (!WARN_ON_ONCE(!dev_pasid)) {
4098+
intel_iommu_debugfs_remove_dev_pasid(dev_pasid);
4099+
kfree(dev_pasid);
4100+
}
41004101
}
41014102

41024103
static void intel_iommu_remove_dev_pasid(struct device *dev, ioasid_t pasid,

0 commit comments

Comments
 (0)