Re: [PATCH 00/14] iommu: fix device leaks
From: Jason Gunthorpe
Date: Tue Sep 30 2025 - 14:22:01 EST
On Thu, Sep 25, 2025 at 02:27:42PM +0200, Johan Hovold wrote:
> This series fixes device leaks in the iommu drivers, which pretty
> consistently failed to drop the reference taken by
> of_find_device_by_node() when looking up iommu platform devices.
Yes, they are mis-designed in many ways :\
IDK if it is worth fixing like this, or if more effort should be put
to make the drivers use of_xlate properly - the arm smmu drivers show
the only way to use it..
But if staying like this then maybe add a little helper?
void *iommu_xlate_to_iommu_drvdata(const struct of_phandle_args *args);
Put the whole racy of_find_device_by_node / put_device /
platform_get_drvdata sequence is in one tidy function.. With
documentation it is not safe don't use it in new code?
Jason