Re: [PATCH v3] iommu/msm: Fix dangling list entry on probe failure
From: Mukesh Ojha
Date: Thu Jul 16 2026 - 08:22:28 EST
On Thu, Jul 16, 2026 at 01:05:57PM +0100, Robin Murphy wrote:
> 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.
Right..I overlooked it.
v2 is fine ..
@Weimin, JFYI, Always send patch revision as a new thread not as a reply of
previous version.
--
-Mukesh Ojha