]> Git Repo - J-linux.git/commitdiff
vfio/pds: Always clear the save/restore FDs on reset
authorBrett Creeley <[email protected]>
Wed, 28 Feb 2024 00:32:04 +0000 (16:32 -0800)
committerAlex Williamson <[email protected]>
Fri, 1 Mar 2024 22:46:21 +0000 (15:46 -0700)
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: 7dabb1bcd177 ("vfio/pds: Add support for firmware recovery")
Cc: [email protected]
Signed-off-by: Brett Creeley <[email protected]>
Reviewed-by: Shannon Nelson <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alex Williamson <[email protected]>
drivers/vfio/pci/pds/vfio_dev.c

index 4c351c59d05a939097d969b7e3da69325dc839b0..a286ebcc71126224c9e3e1fd7c9ad6c6c3bd2cbd 100644 (file)
@@ -32,9 +32,9 @@ again:
        mutex_lock(&pds_vfio->reset_mutex);
        if (pds_vfio->deferred_reset) {
                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) {
-                       pds_vfio_put_restore_file(pds_vfio);
-                       pds_vfio_put_save_file(pds_vfio);
                        pds_vfio_dirty_disable(pds_vfio, false);
                }
                pds_vfio->state = pds_vfio->deferred_reset_state;
This page took 0.057022 seconds and 4 git commands to generate.