OpenCloudOS-Kernel/samples/vfio-mdev
Jason Gunthorpe 3689c75e50 vfio/mbochs: Fix close when multiple device FDs are open
commit 3cb2482714 upstream.

mbochs_close() iterates over global device state and frees it. Currently
this is done every time a device FD is closed, but if multiple device FDs
are open this could corrupt other still active FDs.

Change this to use close_device() so it only runs on the last close.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/11-v4-9ea22c5e6afb+1adf-vfio_reflck_jgg@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Chen Zhuo <sagazchen@tencent.com>
Signed-off-by: Xinghui Li <korantli@tencent.com>
2024-06-11 21:15:41 +08:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mbochs.c vfio/mbochs: Fix close when multiple device FDs are open 2024-06-11 21:15:41 +08:00
mdpy-defs.h treewide: remove SPDX "WITH Linux-syscall-note" from kernel-space headers again 2019-07-25 11:05:10 +02:00
mdpy-fb.c sample: vfio mdev display - guest driver 2018-06-08 10:24:13 -06:00
mdpy.c vfio/samples: Delete useless open/close 2024-06-11 21:15:39 +08:00
mtty.c vfio/samples: Delete useless open/close 2024-06-11 21:15:39 +08:00