]> Git Repo - J-linux.git/commitdiff
vfio/pci: Init the count variable in collecting hot-reset devices
authorYi Liu <[email protected]>
Wed, 10 Jul 2024 00:41:50 +0000 (17:41 -0700)
committerAlex Williamson <[email protected]>
Wed, 10 Jul 2024 14:47:46 +0000 (08:47 -0600)
The count variable is used without initialization, it results in mistakes
in the device counting and crashes the userspace if the get hot reset info
path is triggered.

Fixes: f6944d4a0b87 ("vfio/pci: Collect hot-reset devices to local buffer")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219010
Reported-by: Žilvinas Žaltiena <[email protected]>
Cc: Beld Zhang <[email protected]>
Signed-off-by: Yi Liu <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alex Williamson <[email protected]>
drivers/vfio/pci/vfio_pci_core.c

index 987c7921affa6883232ed2f19eb23ca459c43fd1..ba0ce0075b2fb164a5b8ac7d4aa07a53d2b4beb6 100644 (file)
@@ -1260,7 +1260,7 @@ static int vfio_pci_ioctl_get_pci_hot_reset_info(
        struct vfio_pci_hot_reset_info hdr;
        struct vfio_pci_fill_info fill = {};
        bool slot = false;
-       int ret, count;
+       int ret, count = 0;
 
        if (copy_from_user(&hdr, arg, minsz))
                return -EFAULT;
This page took 0.050637 seconds and 4 git commands to generate.