linux/drivers/vfio
Giovanni Cabiddu 4ec5e932e6 vfio/qat: fix f_pos race in qat_vf_resume_write()
qat_vf_resume_write() checks filp->f_pos before taking migf->lock, but
copies into the migration-state buffer after taking the lock and
re-reading the shared file position.

Two concurrent writers could therefore pass the bounds check with the
old offset, then have the second writer copy after the first advanced
f_pos, writing past the end of the migration-state buffer.

Take migf->lock before doing the boundary checks.

Fixes: bb208810b1 ("vfio/qat: Add vfio_pci driver for Intel QAT SR-IOV VF devices")
Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Link: https://lore.kernel.org/r/20260608151317.136613-1-giovanni.cabiddu@intel.com
Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-06-10 14:33:05 -06:00
..
cdx vfio/cdx: Consolidate MSI configured state onto cdx_irqs 2026-04-21 12:01:22 -06:00
fsl-mc bus: fsl-mc: use generic driver_override infrastructure 2026-04-04 20:41:25 +02:00
mdev Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pci vfio/qat: fix f_pos race in qat_vf_resume_write() 2026-06-10 14:33:05 -06:00
platform treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
container.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
debugfs.c vfio: Dump migration features under debugfs 2025-10-06 11:22:48 -06:00
device_cdev.c vfio: replace vfio->device_class with a const struct class 2026-04-21 12:01:21 -06:00
group.c vfio: remove dead notifier code 2026-04-10 13:32:25 -06:00
iommufd.c vfio: Fix unbalanced vfio_df_close call in no-iommu mode 2025-07-11 14:43:37 -06:00
Kconfig vfio/migration: Add debugfs to live migration driver 2023-12-04 14:29:08 -07:00
Makefile vfio/migration: Add debugfs to live migration driver 2023-12-04 14:29:08 -07:00
vfio_iommu_spapr_tce.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vfio_iommu_type1.c vfio: remove dead notifier code 2026-04-10 13:32:25 -06:00
vfio_main.c vfio: prevent infinite loop in vfio_mig_get_next_state() on blocked arc 2026-06-05 10:45:41 -06:00
vfio.h vfio: replace vfio->device_class with a const struct class 2026-04-21 12:01:21 -06:00
virqfd.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00