linux_dsm_epyc7002/drivers/vfio
Jason Gunthorpe b29d6a435e vfio/mdev: Do not allow a mdev_type to have a NULL parent pointer
[ Upstream commit b5a1f8921d5040bb788492bf33a66758021e4be5 ]

There is a small race where the parent is NULL even though the kobj has
already been made visible in sysfs.

For instance the attribute_group is made visible in sysfs_create_files()
and the mdev_type_attr_show() does:

    ret = attr->show(kobj, type->parent->dev, buf);

Which will crash on NULL parent. Move the parent setup to before the type
pointer leaves the stack frame.

Fixes: 7b96953bc6 ("vfio: Mediated device Core driver")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Message-Id: <2-v2-d36939638fc6+d54-vfio2_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:26 +02:00
..
fsl-mc vfio/fsl-mc: Re-order vfio_fsl_mc_probe() 2021-05-14 09:50:25 +02:00
mdev vfio/mdev: Do not allow a mdev_type to have a NULL parent pointer 2021-05-14 09:50:26 +02:00
pci vfio/pci: Re-order vfio_pci_probe() 2021-05-14 09:50:25 +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_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
vfio.c vfio: fix a missed vfio group put in vfio_pin_pages 2020-09-22 10:56:40 -06:00
virqfd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00