linux_dsm_epyc7002/drivers/vfio/pci
Jason Gunthorpe 87856f9af0 vfio/pci: Re-order vfio_pci_probe()
[ Upstream commit 4aeec3984ddc853f7c65903bde472ffdef738bae ]

vfio_add_group_dev() must be called only after all of the private data in
vdev is fully setup and ready, otherwise there could be races with user
space instantiating a device file descriptor and starting to call ops.

For instance vfio_pci_reflck_attach() sets vdev->reflck and
vfio_pci_open(), called by fops open, unconditionally derefs it, which
will crash if things get out of order.

Fixes: cc20d79990 ("vfio/pci: Introduce VF token")
Fixes: e309df5b0c ("vfio/pci: Parallelize device open and release")
Fixes: 6eb7018705 ("vfio-pci: Move idle devices to D3hot power state")
Fixes: ecaa1f6a01 ("vfio-pci: Add VGA arbiter client")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Message-Id: <8-v3-225de1400dfc+4e074-vfio1_jgg@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-14 09:50:25 +02:00
..
Kconfig vfio/nvlink: Add missing SPAPR_TCE_IOMMU depends 2021-04-07 15:00:11 +02:00
Makefile vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO 2020-10-12 11:37:59 -06:00
trace.h vfio/pci: Cleanup license mess 2019-01-22 11:06:05 -07:00
vfio_pci_config.c Merge branches 'v5.10/vfio/bardirty', 'v5.10/vfio/dma_avail', 'v5.10/vfio/misc', 'v5.10/vfio/no-cmd-mem' and 'v5.10/vfio/yan_zhao_fixes' into v5.10/vfio/next 2020-09-22 10:56:51 -06:00
vfio_pci_igd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
vfio_pci_intrs.c vfio/pci: Clear token on bypass registration failure 2020-10-19 07:13:55 -06:00
vfio_pci_nvlink2.c vfio/pci/nvlink2: Do not attempt NPU2 setup on POWER8NVL NPU 2020-12-30 11:54:03 +01:00
vfio_pci_private.h vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO 2020-10-12 11:37:59 -06:00
vfio_pci_rdwr.c vfio/pci: Implement ioeventfd thread handler for contended memory lock 2020-11-03 11:07:40 -07:00
vfio_pci_zdev.c vfio-pci/zdev: fix possible segmentation fault issue 2021-03-04 11:38:13 +01:00
vfio_pci.c vfio/pci: Re-order vfio_pci_probe() 2021-05-14 09:50:25 +02:00