RE: [PATCH 3/4] iommufd: Release current IOAS on xa_store() failure

From: Tian, Kevin

Date: Mon Jul 27 2026 - 05:42:50 EST


> From: Shuai Xue <xueshuai@xxxxxxxxxxxxxxxxx>
> Sent: Sunday, July 26, 2026 3:44 PM
>
> iommufd_take_all_iova_rwsem() takes an object reference and the
> iova_rwsem write lock before storing the IOAS in the temporary ioas_list
> xarray.
>
> If xa_store() fails, the current IOAS has not been inserted into
> ioas_list yet. iommufd_release_all_iova_rwsem() only unwinds IOAS
> objects already present in that xarray, so it cannot release the current
> IOAS.
>
> Release the current IOAS rwsem and object reference before unwinding the
> previously stored entries.
>
> Fixes: 051ae5aa73d7 ("iommufd: Lock all IOAS objects")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: Qoder:Qwen-3.8-MAX-Preview
> Signed-off-by: Shuai Xue <xueshuai@xxxxxxxxxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>