-
由 Jason Gunthorpe 提交于
stable inclusion from stable-5.10.37 commit 87856f9af04eaacf9848710625a4ffee1d020fa9 bugzilla: 51868 CVE: NA -------------------------------- [ Upstream commit 4aeec398 ] 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: cc20d799 ("vfio/pci: Introduce VF token") Fixes: e309df5b ("vfio/pci: Parallelize device open and release") Fixes: 6eb70187 ("vfio-pci: Move idle devices to D3hot power state") Fixes: ecaa1f6a ("vfio-pci: Add VGA arbiter client") Reviewed-by: NChristoph Hellwig <hch@lst.de> Reviewed-by: NMax Gurtovoy <mgurtovoy@nvidia.com> Reviewed-by: NKevin Tian <kevin.tian@intel.com> Reviewed-by: NCornelia Huck <cohuck@redhat.com> Reviewed-by: NEric Auger <eric.auger@redhat.com> Signed-off-by: NJason Gunthorpe <jgg@nvidia.com> Message-Id: <8-v3-225de1400dfc+4e074-vfio1_jgg@nvidia.com> Signed-off-by: NAlex Williamson <alex.williamson@redhat.com> Signed-off-by: NSasha Levin <sashal@kernel.org> Signed-off-by: NChen Jun <chenjun102@huawei.com> Acked-by: NWeilong Chen <chenweilong@huawei.com> Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
ae7595e7