mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-11 11:55:28 +02:00
vfio/pci: Init the count variable in collecting hot-reset devices
[ Upstream commit5a88a3f67e
] 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:f6944d4a0b
("vfio/pci: Collect hot-reset devices to local buffer") Link: https://bugzilla.kernel.org/show_bug.cgi?id=219010 Reported-by: Žilvinas Žaltiena <zaltys@natrix.lt> Cc: Beld Zhang <beldzhang@gmail.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20240710004150.319105-1-yi.l.liu@intel.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c3111b3cf3
commit
f476dffc52
|
@ -1260,7 +1260,7 @@ static int vfio_pci_ioctl_get_pci_hot_reset_info(
|
||||||
struct vfio_pci_hot_reset_info hdr;
|
struct vfio_pci_hot_reset_info hdr;
|
||||||
struct vfio_pci_fill_info fill = {};
|
struct vfio_pci_fill_info fill = {};
|
||||||
bool slot = false;
|
bool slot = false;
|
||||||
int ret, count;
|
int ret, count = 0;
|
||||||
|
|
||||||
if (copy_from_user(&hdr, arg, minsz))
|
if (copy_from_user(&hdr, arg, minsz))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user