[PATCH 0/2] pci: config space bounds check and correction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Doing device assignement using a PCIe device with it's
PCI Cap structure at offset 0xcc showed a problem in
the default size mapped for this cap-id.

The failure caused a corruption which might have gone unnoticed
otherwise.

So, add a bounds check in pci_add_capability() & fprintf()
to detail which device & cap structure.  While there, adjust
overlap check to prefix output with '0x' so it's clear in output.
Note: bounds check a bit odd looking, but that's because offset & size
      are uint8's and comparing to greater than 256.

Next, fix assigned_device_pci_cap_init() to set the default
size of PCIe Cap structure (cap-id 0x10) to 0x34 instead of 0x3c.
0x34 is default, min, for endpoint device with a cap version of 2.
Algorithm will have to get a bit more complicated if 
non-endpoint (mriov-based switches?) are ever device-assigned.

Signed-off-by: Donald Dutile <ddutile@xxxxxxxxxx>
cc: Alex Williamson <alex.williamson@xxxxxxxxxx>
cc: Michael S. Tsirkin <mst@xxxxxxxxxx>

---

Donald Dutile (2):
      pci: correct pci config size default for cap version 2 endpoints
      pci: bounds check offsets into config_map


 hw/device-assignment.c |    4 +++-
 hw/pci.c               |   16 ++++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

-- 

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux