Skip to content

Commit 32ea2c5

Browse files
vladimirolteanjoergroedel
authored andcommitted
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: 57365a0 ("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>
1 parent ce31e6c commit 32ea2c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3858,7 +3858,9 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
38583858

38593859
static void arm_smmu_device_shutdown(struct platform_device *pdev)
38603860
{
3861-
arm_smmu_device_remove(pdev);
3861+
struct arm_smmu_device *smmu = platform_get_drvdata(pdev);
3862+
3863+
arm_smmu_device_disable(smmu);
38623864
}
38633865

38643866
static const struct of_device_id arm_smmu_of_match[] = {

0 commit comments

Comments
 (0)