projects/linux·commit 43ecdb0d

Merge tag 'vfio-v3.9-rc7' of git://github.com/awilliam/linux-vfio

43ecdb0d · Linus Torvalds <[email protected]> · 2013-04-09 12:07:01 -07:00

Pull vfio overflow fix from Alex Williamson.

* tag 'vfio-v3.9-rc7' of git://github.com/awilliam/linux-vfio:
  vfio-pci: Fix possible integer overflow
Commit
43ecdb0d31cf63d99d060af0585bf59be7fafcb2
Parents
27387dd8 · 904c680c

Merge commit. Changes below are compared with the first parent: 27387dd8.

Changes

1 files changed · +2 −1

FileStatusAddDelContent
drivers/vfio/pci/vfio_pci.cmodified+2−1View file

drivers/vfio/pci/vfio_pci.c

View file
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index 8189cb6..7abc5c8 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -346,6 +346,7 @@ static long vfio_pci_ioctl(void *device_data,
if (!(hdr.flags & VFIO_IRQ_SET_DATA_NONE)) {
size_t size;
+ int max = vfio_pci_get_irq_count(vdev, hdr.index);
if (hdr.flags & VFIO_IRQ_SET_DATA_BOOL)
size = sizeof(uint8_t);
@@ -355,7 +356,7 @@ static long vfio_pci_ioctl(void *device_data,
return -EINVAL;
if (hdr.argsz - minsz < hdr.count * size ||
- hdr.count > vfio_pci_get_irq_count(vdev, hdr.index))
+ hdr.start >= max || hdr.start + hdr.count > max)
return -EINVAL;
data = memdup_user((void __user *)(arg + minsz),