Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce7585f3 authored by Alex Williamson's avatar Alex Williamson
Browse files

vfio/pci: Allow VPD short read



The size of the VPD area is not necessarily 4-byte aligned, so a
pci_vpd_read() might return less than 4 bytes.  Zero our buffer and
accept anything other than an error.  Intel X710 NICs exercise this.

Fixes: 4e1a6355 ("vfio/pci: Use kernel VPD access functions")
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 089f1c6b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -749,7 +749,8 @@ static int vfio_vpd_config_write(struct vfio_pci_device *vdev, int pos,
		if (pci_write_vpd(pdev, addr & ~PCI_VPD_ADDR_F, 4, &data) != 4)
			return count;
	} else {
		if (pci_read_vpd(pdev, addr, 4, &data) != 4)
		data = 0;
		if (pci_read_vpd(pdev, addr, 4, &data) < 0)
			return count;
		*pdata = cpu_to_le32(data);
	}