Skip to content

Commit 5a88a3f

Browse files
yiliu1765awilliam
authored andcommitted
vfio/pci: Init the count variable in collecting hot-reset devices
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: f6944d4 ("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]>
1 parent 256abd8 commit 5a88a3f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/vfio/pci/vfio_pci_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ static int vfio_pci_ioctl_get_pci_hot_reset_info(
12601260
struct vfio_pci_hot_reset_info hdr;
12611261
struct vfio_pci_fill_info fill = {};
12621262
bool slot = false;
1263-
int ret, count;
1263+
int ret, count = 0;
12641264

12651265
if (copy_from_user(&hdr, arg, minsz))
12661266
return -EFAULT;

0 commit comments

Comments
 (0)