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

Commit da5d2748 authored by Joerg Roedel's avatar Joerg Roedel
Browse files

iommu/mediatek: Use correct fwspec in mtk_iommu_add_device()



The mtk_iommu_add_device() function keeps the fwspec in an
on-stack pointer and calls mtk_iommu_create_mapping(), which
might change its source, dev->iommu_fwspec. This causes the
on-stack pointer to be obsoleted and the device
initialization to fail. Update the on-stack fwspec pointer
after mtk_iommu_create_mapping() has been called.

Reported-by: default avatarFrank Wunderlich <frank-w@public-files.de>
Fixes: a9bf2eec ('iommu/mediatek: Use helper functions to access dev->iommu_fwspec')
Tested-by: default avatarFrank Wunderlich <frank-w@public-files.de>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 198bc325
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -442,6 +442,10 @@ static int mtk_iommu_add_device(struct device *dev)
		iommu_spec.args_count = count;

		mtk_iommu_create_mapping(dev, &iommu_spec);

		/* dev->iommu_fwspec might have changed */
		fwspec = dev_iommu_fwspec_get(dev);

		of_node_put(iommu_spec.np);
	}