]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vfio/pds: Always clear the save/restore FDs on reset
authorBrett Creeley <brett.creeley@amd.com>
Wed, 28 Feb 2024 00:32:04 +0000 (16:32 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:28:23 +0000 (15:28 +0200)
commit245c318cdad0259dbca593d6d9ad13bb19947db6
treee478f3ee6abf3b32e0c694f712f63f0f2ffd4de7
parent35c1cdd504a3957da80670606ec109fb1576f1bd
vfio/pds: Always clear the save/restore FDs on reset

[ Upstream commit 8512ed256334f6637fc0699ce794792c357544ec ]

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: 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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/pci/pds/vfio_dev.c