diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-12-15 16:12:51 +0200 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2023-01-13 13:46:21 +0100 |
commit | 32ea2c57dc216b6ad8125fa680d31daa5d421c95 (patch) | |
tree | 2281d1d7fd1b68374d46449b4f499b7e6fdec25f /drivers/iommu | |
parent | ce31e6ca68bd7639bd3e5ef97be215031842bbab (diff) | |
download | linux-32ea2c57dc216b6ad8125fa680d31daa5d421c95.tar.gz linux-32ea2c57dc216b6ad8125fa680d31daa5d421c95.tar.bz2 linux-32ea2c57dc216b6ad8125fa680d31daa5d421c95.zip |
iommu/arm-smmu-v3: Don't unregister on shutdown
Similar to SMMUv2, this driver calls iommu_device_unregister() from the
shutdown path, which removes the IOMMU groups with no coordination
whatsoever with their users - shutdown methods are optional in device
drivers. This can lead to NULL pointer dereferences in those drivers'
DMA API calls, or worse.
Instead of calling the full arm_smmu_device_remove() from
arm_smmu_device_shutdown(), let's pick only the relevant function call -
arm_smmu_device_disable() - more or less the reverse of
arm_smmu_device_reset() - and call just that from the shutdown path.
Fixes: 57365a04c921 ("iommu: Move bus setup to IOMMU device registration")
Suggested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20221215141251.3688780-2-vladimir.oltean@nxp.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index ab160198edd6..f2425b0f0cd6 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3858,7 +3858,9 @@ static int arm_smmu_device_remove(struct platform_device *pdev) static void arm_smmu_device_shutdown(struct platform_device *pdev) { - arm_smmu_device_remove(pdev); + struct arm_smmu_device *smmu = platform_get_drvdata(pdev); + + arm_smmu_device_disable(smmu); } static const struct of_device_id arm_smmu_of_match[] = { |