diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-09 15:07:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-09 15:07:01 -0400 |
commit | 43ecdb0d31cf63d99d060af0585bf59be7fafcb2 (patch) | |
tree | cc2892b7c810ea4b03db93f1177f498fcdc166a8 | |
parent | 27387dd8c62d24140d80382918aff69d4e0821ce (diff) | |
parent | 904c680c7bf016a8619a045850937427f8d7368c (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.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 8189cb6a86af..7abc5c81af2c 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, | |||
346 | 346 | ||
347 | if (!(hdr.flags & VFIO_IRQ_SET_DATA_NONE)) { | 347 | if (!(hdr.flags & VFIO_IRQ_SET_DATA_NONE)) { |
348 | size_t size; | 348 | size_t size; |
349 | int max = vfio_pci_get_irq_count(vdev, hdr.index); | ||
349 | 350 | ||
350 | if (hdr.flags & VFIO_IRQ_SET_DATA_BOOL) | 351 | if (hdr.flags & VFIO_IRQ_SET_DATA_BOOL) |
351 | size = sizeof(uint8_t); | 352 | size = sizeof(uint8_t); |
@@ -355,7 +356,7 @@ static long vfio_pci_ioctl(void *device_data, | |||
355 | return -EINVAL; | 356 | return -EINVAL; |
356 | 357 | ||
357 | if (hdr.argsz - minsz < hdr.count * size || | 358 | if (hdr.argsz - minsz < hdr.count * size || |
358 | hdr.count > vfio_pci_get_irq_count(vdev, hdr.index)) | 359 | hdr.start >= max || hdr.start + hdr.count > max) |
359 | return -EINVAL; | 360 | return -EINVAL; |
360 | 361 | ||
361 | data = memdup_user((void __user *)(arg + minsz), | 362 | data = memdup_user((void __user *)(arg + minsz), |