On Tue, 15 Jul 2025 20:06:18 -0300
Jason Gunthorpe <j...@nvidia.com> wrote:

> On Wed, Jul 16, 2025 at 01:55:45AM +0300, Dan Carpenter wrote:
> > 5fcc26969a164e Yi Liu          2023-07-18  117      
> > mutex_lock(&device->dev_set->lock);
> > 5fcc26969a164e Yi Liu          2023-07-18  118      /* one device cannot be 
> > bound twice */
> > 5fcc26969a164e Yi Liu          2023-07-18  119      if (df->access_granted) 
> > {
> > 5fcc26969a164e Yi Liu          2023-07-18  120              ret = -EINVAL;
> > 5fcc26969a164e Yi Liu          2023-07-18  121              goto out_unlock;
> > 5fcc26969a164e Yi Liu          2023-07-18  122      }
> > 5fcc26969a164e Yi Liu          2023-07-18  123  
> > be2e70b96c3e54 Jason Gunthorpe 2025-07-14  124      ret = 
> > vfio_df_check_token(device, &bind);
> > be2e70b96c3e54 Jason Gunthorpe 2025-07-14  125      if (ret)
> > be2e70b96c3e54 Jason Gunthorpe 2025-07-14 @126              return ret;
> > 
> > This needs to be a goto unlock.  
> 
> Oop yes, thank you
> 
> Alex can you fix it up when applying?

Yes, I'll apply with:

diff --git a/drivers/vfio/device_cdev.c b/drivers/vfio/device_cdev.c
index 53a602563f00..480cac3a0c27 100644
--- a/drivers/vfio/device_cdev.c
+++ b/drivers/vfio/device_cdev.c
@@ -123,7 +123,7 @@ long vfio_df_ioctl_bind_iommufd(struct vfio_device_file *df,
 
        ret = vfio_df_check_token(device, &bind);
        if (ret)
-               return ret;
+               goto out_unlock;
 
        df->iommufd = iommufd_ctx_from_fd(bind.iommufd);
        if (IS_ERR(df->iommufd)) {


Reply via email to