summaryrefslogtreecommitdiff
path: root/block/blk.h
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2016-04-29 04:11:52 (GMT)
committerAlex Williamson <alex.williamson@redhat.com>2016-05-19 21:04:40 (GMT)
commitf70552809419cd2abc0cc6469a07c9792a3aaa6c (patch)
tree90e6c16418c883f54310600686c5be2d210dd347 /block/blk.h
parent5ed4aba1265f3c7532bf4ae1f25a277568b86871 (diff)
downloadlinux-f70552809419cd2abc0cc6469a07c9792a3aaa6c.tar.xz
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 'block/blk.h')
0 files changed, 0 insertions, 0 deletions