Re: [PATCH v3] iommu/msm: Fix dangling list entry on probe failure

From: Robin Murphy

Date: Thu Jul 16 2026 - 08:09:32 EST


On 16/07/2026 10:42 am, Konrad Dybcio wrote:
On 7/16/26 10:53 AM, Weimin Xiong wrote:
Move the list_add() call to the end of msm_iommu_probe() instead of
adding cleanup paths, which avoids the dangling list entry problem
entirely (suggested by Mukesh Ojha).

This approach simplifies the code by ensuring the iommu device is
never added to the global list until after all potential failure
points have passed.

Changes in v3:
- Move list_add() to the end instead of adding cleanup labels
(suggested by Mukesh Ojha)

I think this approach introduces a race condition, because e.g.
iommu_ops->of_xlate() depends on the item being present in this list

Yes, the IOMMU instance must be ready to be fully functional *before* calling iommu_device_register(), since that can start probing and attaching client devices before it returns.

Thanks,
Robin.