summaryrefslogtreecommitdiff
path: root/drivers/vfio/platform/vfio_platform_irq.c
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2024-03-09 02:05:26 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-13 13:58:32 +0300
commitad68ce4936165cfd8b41f020cbd5b63799d8d336 (patch)
tree9887731bb3c14d4feea2f3acf5fdf35048865723 /drivers/vfio/platform/vfio_platform_irq.c
parentef73db1cc885c21123541ef57ee0574b16a4409b (diff)
downloadlinux-ad68ce4936165cfd8b41f020cbd5b63799d8d336.tar.xz
vfio/platform: Disable virqfds on cleanup
[ Upstream commit fcdc0d3d40bc26c105acf8467f7d9018970944ae ] irqfds for mask and unmask that are not specifically disabled by the user are leaked. Remove any irqfds during cleanup Cc: Eric Auger <eric.auger@redhat.com> Cc: <stable@vger.kernel.org> Fixes: a7fa7c77cf15 ("vfio/platform: implement IRQ masking/unmasking via an eventfd") Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Link: https://lore.kernel.org/r/20240308230557.805580-6-alex.williamson@redhat.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/vfio/platform/vfio_platform_irq.c')
-rw-r--r--drivers/vfio/platform/vfio_platform_irq.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/vfio/platform/vfio_platform_irq.c b/drivers/vfio/platform/vfio_platform_irq.c
index c5b09ec0a3c9..f2893f2fcaab 100644
--- a/drivers/vfio/platform/vfio_platform_irq.c
+++ b/drivers/vfio/platform/vfio_platform_irq.c
@@ -321,8 +321,11 @@ void vfio_platform_irq_cleanup(struct vfio_platform_device *vdev)
{
int i;
- for (i = 0; i < vdev->num_irqs; i++)
+ for (i = 0; i < vdev->num_irqs; i++) {
+ vfio_virqfd_disable(&vdev->irqs[i].mask);
+ vfio_virqfd_disable(&vdev->irqs[i].unmask);
vfio_set_trigger(vdev, i, -1, NULL);
+ }
vdev->num_irqs = 0;
kfree(vdev->irqs);