summaryrefslogtreecommitdiffstats
path: root/net/netlink
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2016-04-29 14:11:52 +1000
committerAlex Williamson <alex.williamson@redhat.com>2016-05-19 15:04:40 -0600
commitf70552809419cd2abc0cc6469a07c9792a3aaa6c (patch)
tree90e6c16418c883f54310600686c5be2d210dd347 /net/netlink
parent5ed4aba1265f3c7532bf4ae1f25a277568b86871 (diff)
downloadlinux-f70552809419cd2abc0cc6469a07c9792a3aaa6c.tar.gz
linux-f70552809419cd2abc0cc6469a07c9792a3aaa6c.tar.bz2
linux-f70552809419cd2abc0cc6469a07c9792a3aaa6c.zip
vfio_pci: Test for extended capabilities if config space > 256 bytes
PCI-Express spec says that reading 4 bytes at offset 100h should return zero if there is no extended capability so VFIO reads this dword to know if there are extended capabilities. However it is not always possible to access the extended space so generic PCI code in pci_cfg_space_size_ext() checks if pci_read_config_dword() can read beyond 100h and if the check fails, it sets the config space size to 100h. VFIO does its own extended capabilities check by reading at offset 100h which may produce 0xffffffff which VFIO treats as the extended config space presense and calls vfio_ecap_init() which fails to parse capabilities (which is expected) but right before the exit, it writes zero at offset 100h which is beyond the buffer allocated for vdev->vconfig (which is 256 bytes) which leads to random memory corruption. This makes VFIO only check for the extended capabilities if the discovered config size is more than 256 bytes. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'net/netlink')
0 files changed, 0 insertions, 0 deletions