Skip to content

vfio/pci: reject invalid PCI_INTERRUPT_PIN values

Denis V. Lunev qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 5 repliesIn review
  2. v11 patch 1 replySuperseded

Changes in v2 from the cover letter

* original submission was wrongly ported patch from downstream. Fixed
* added checks for narrowed values

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2vfio/pci: don't narrow a failed config read to a plausible valuehw/vfio/pci.c+25 -72 replies
2/2vfio/pci: reject invalid PCI_INTERRUPT_PIN valueshw/vfio/pci.c+5 -03 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchCédric Le GoaterPhilippe Mathieu-Daudé
1/2R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] vfio/pci: reject invalid PCI_INTERRUPT_PIN values

qemu-kvm aborts a few seconds after starting a VM with a passed-through GPU whose PCI_INTERRUPT_PIN comes back as an out-of-range value: vfio_intx_enable() only guards against pin == 0 and stores vdev->intx.pin = pin - 1 with no upper-bound check. That value reaches pci_irq_handler()'s
assert(0 <= irq_num && irq_num < PCI_NUM_PINS) via pci_irq_deassert() -> pci_set_irq(), aborting the whole process instead of just failing the device.

v1 -> v2:
* original submission was wrongly ported patch from downstream. Fixed
* added checks for narrowed values

CC Alex Williamson <[email protected]>
CC "Cédric Le Goater" <[email protected]>

Denis V. Lunev (2):
vfio/pci: don't narrow a failed config read to a plausible value vfio/pci: reject invalid PCI_INTERRUPT_PIN values

 hw/vfio/pci.c | 37 ++++++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 7 deletions(-)
Signature · 1 line
2.53.0