On Wed, Oct 30, 2024 at 02:34:30PM -0700, Nicolin Chen wrote:
> To support driver-allocated vIOMMU objects, it's required for IOMMU driver
> to call the provided iommufd_viommu_alloc helper to embed the core struct.
> However, there is no guarantee that every driver will call it and allocate
> objects properly.
> 
> Make the iommufd_object_finalize/abort functions more robust to verify if
> the xarray slot indexed by the input obj->id is having an XA_ZERO_ENTRY,
> which is the reserved value stored by xa_alloc via iommufd_object_alloc.
> 
> Suggested-by: Jason Gunthorpe <[email protected]>
> Signed-off-by: Nicolin Chen <[email protected]>
> ---
>  drivers/iommu/iommufd/main.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)

Reviewed-by: Jason Gunthorpe <[email protected]>

Jason

Reply via email to