Re: [PATCH v2] iommu/msm: unwind probe state on registration failure
From: Mukesh Ojha
Date: Thu Jul 16 2026 - 08:27:54 EST
On Thu, Jul 16, 2026 at 09:32:29AM +0800, Weimin Xiong wrote:
> msm_iommu_probe() adds its devm-managed IOMMU object to
> qcom_iommu_devices before adding the IOMMU sysfs device and registering
> it with the IOMMU core.
>
> If iommu_device_sysfs_add() fails, probe returns with the object still on
> qcom_iommu_devices. The driver core then releases the devm allocation,
> leaving a dangling list entry that later list walks may dereference.
>
> If iommu_device_register() fails, the same dangling list entry remains
> and the sysfs device is left registered as well.
>
> Unwind the sysfs device and global list entry in reverse setup order on
> the corresponding failure paths.
>
> Fixes: 42df43b36163 ("iommu/msm: Make use of iommu_device_register interface")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Weimin Xiong <xiongwm2026@xxxxxxx>
Reviewed-by: Mukesh Ojha <mukesh.ojha@xxxxxxxxxxxxxxxx>
--
-Mukesh Ojha