On Thu, Nov 14, 2024 at 11:53:18AM +0200, Yishai Hadas wrote: > Fix unwind flows in mlx5vf_pci_save_device_data() and > mlx5vf_pci_resume_device_data() to avoid freeing the migf pointer at the > 'end' label, as this will be handled by fput(migf->filp) through > mlx5vf_release_file(). > > To ensure mlx5vf_release_file() functions correctly, move the > initialization of migf fields (such as migf->lock) to occur before any > potential unwind flow, as these fields may be accessed within > mlx5vf_release_file(). > > Fixes: 9945a67ea4b3 ("vfio/mlx5: Refactor PD usage") > Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxx> > --- > drivers/vfio/pci/mlx5/main.c | 35 +++++++++++++++++------------------ > 1 file changed, 17 insertions(+), 18 deletions(-) Tricky Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Jason