Skip to content

Commit

Permalink
Merge tag 'vfio-v3.9-rc7' of git://github.com/awilliam/linux-vfio
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Linus Torvalds committed Apr 9, 2013
2 parents 27387dd + 904c680 commit 43ecdb0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/vfio/pci/vfio_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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),
Expand Down

0 comments on commit 43ecdb0

Please sign in to comment.