mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-29 14:05:19 +08:00
vfio/pds: Always clear the save/restore FDs on reset
After reset the VFIO device state will always be put in
VFIO_DEVICE_STATE_RUNNING, but the save/restore files will only be
cleared if the previous state was VFIO_DEVICE_STATE_ERROR. This
can/will cause the restore/save files to be leaked if/when the
migration state machine transitions through the states that
re-allocates these files. Fix this by always clearing the
restore/save files for resets.
Fixes: 7dabb1bcd1
("vfio/pds: Add support for firmware recovery")
Cc: stable@vger.kernel.org
Signed-off-by: Brett Creeley <brett.creeley@amd.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20240228003205.47311-2-brett.creeley@amd.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
701ab93585
commit
8512ed2563
@ -32,9 +32,9 @@ again:
|
|||||||
mutex_lock(&pds_vfio->reset_mutex);
|
mutex_lock(&pds_vfio->reset_mutex);
|
||||||
if (pds_vfio->deferred_reset) {
|
if (pds_vfio->deferred_reset) {
|
||||||
pds_vfio->deferred_reset = false;
|
pds_vfio->deferred_reset = false;
|
||||||
|
pds_vfio_put_restore_file(pds_vfio);
|
||||||
|
pds_vfio_put_save_file(pds_vfio);
|
||||||
if (pds_vfio->state == VFIO_DEVICE_STATE_ERROR) {
|
if (pds_vfio->state == VFIO_DEVICE_STATE_ERROR) {
|
||||||
pds_vfio_put_restore_file(pds_vfio);
|
|
||||||
pds_vfio_put_save_file(pds_vfio);
|
|
||||||
pds_vfio_dirty_disable(pds_vfio, false);
|
pds_vfio_dirty_disable(pds_vfio, false);
|
||||||
}
|
}
|
||||||
pds_vfio->state = pds_vfio->deferred_reset_state;
|
pds_vfio->state = pds_vfio->deferred_reset_state;
|
||||||
|
Loading…
Reference in New Issue
Block a user