linux-stable/drivers/vfio
Jason Gunthorpe daa72300c9 vfio/fsl-mc: Re-order vfio_fsl_mc_probe()
[ Upstream commit 2b1fe162e5 ]

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_fsl_mc_reflck_attach() sets vdev->reflck and
vfio_fsl_mc_open(), called by fops open, unconditionally derefs it, which
will crash if things get out of order.

This driver started life with the right sequence, but two commits added
stuff after vfio_add_group_dev().

Fixes: 2e0d29561f ("vfio/fsl-mc: Add irq infrastructure for fsl-mc devices")
Fixes: f2ba7e8c94 ("vfio/fsl-mc: Added lock support in preparation for interrupt handling")
Co-developed-by: Diana Craciun OSS <diana.craciun@oss.nxp.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Message-Id: <5-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
..
fsl-mc vfio/fsl-mc: Re-order vfio_fsl_mc_probe() 2021-05-14 09:50:25 +02:00
mdev vfio/mdev: Fix reference count leak in add_mdev_supported_type 2020-05-29 16:07:18 -06:00
pci vfio/pci: Add missing range check in vfio_pci_mmap 2021-04-21 13:00:55 +02:00
platform vfio: platform: fix reference leak in vfio_platform_open 2020-11-03 11:07:40 -07:00
Kconfig vfio: Depend on MMU 2021-05-07 11:04:33 +02:00
Makefile vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices 2020-10-07 14:17:33 -06:00
vfio.c vfio: fix a missed vfio group put in vfio_pin_pages 2020-09-22 10:56:40 -06:00
vfio_iommu_spapr_tce.c vfio/spapr_tce: convert get_user_pages() --> pin_user_pages() 2020-07-27 13:43:38 -06:00
vfio_iommu_type1.c vfio/type1: Use follow_pte() 2021-03-04 11:38:17 +01:00
vfio_spapr_eeh.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
virqfd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00