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

"Tian, Kevin" <[email protected]> Mon, 27 Jul 2026 09:39:12 +0000
Newsgroups dev.linux.lists.iommu,org.kernel.vger.linux-kernel
Message-ID <CO1PR11MB48358ACFA7AAF6200CBEEF4D8CCC2@CO1PR11MB4835.namprd11.prod.outlook.com>
> From: Shuai Xue <[email protected]>
> 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: [email protected]
> Assisted-by: Qoder:Qwen-3.8-MAX-Preview
> Signed-off-by: Shuai Xue <[email protected]>

Reviewed-by: Kevin Tian <[email protected]>