aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-09 12:07:01 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-09 12:07:01 -0700
commit43ecdb0d31cf63d99d060af0585bf59be7fafcb2 (patch)
treecc2892b7c810ea4b03db93f1177f498fcdc166a8
parent27387dd8c62d24140d80382918aff69d4e0821ce (diff)
parent904c680c7bf016a8619a045850937427f8d7368c (diff)
Merge tag 'vfio-v3.9-rc7' of git://github.com/awilliam/linux-vfio
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
-rw-r--r--drivers/vfio/pci/vfio_pci.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index 8189cb6a86a..7abc5c81af2 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),