Re: [PATCH v2 2/2] vfio: Fix unbalanced vfio_df_close call in no-iommu mode
From: Jason Gunthorpe
Date: Mon Jun 16 2025 - 16:06:13 EST
On Mon, Jun 16, 2025 at 01:40:04PM -0600, Alex Williamson wrote:
> --- a/drivers/vfio/group.c
> +++ b/drivers/vfio/group.c
> @@ -192,18 +192,18 @@ static int vfio_df_group_open(struct vfio_device_file *df)
> * implies they expected translation to exist
> */
> if (!capable(CAP_SYS_RAWIO) ||
> - vfio_iommufd_device_has_compat_ioas(device, df->iommufd))
> + vfio_iommufd_device_has_compat_ioas(device, df->iommufd)) {
> ret = -EPERM;
> - else
> - ret = 0;
> - goto out_put_kvm;
> + goto out_put_kvm;
> + }
> }
>
>
> And add a noiommu exit branch to _iommufd_bind, symmetric to unbind.
> Right? Thanks,
Just comparing to the original
+ if (iommufd) {
+ if (!vfio_device_is_noiommu(device))
+ ret = vfio_df_iommufd_bind(df);
Isn't being captured, so it needs another hunk in
vfio_df_iommufd_bind()
Jason