diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-12-02 16:30:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-12-02 16:30:25 -0500 |
commit | f9143eae1035195352da7577d89ec5982cbc9f72 (patch) | |
tree | 4f08a89256cdd4944cd68431fbeb4aabda525a1f /drivers | |
parent | ffb8fb5469315755ec2dd462452dcb869b358d55 (diff) | |
parent | dfd8ee92a9192d78aa38cf8699df3630a7c88c85 (diff) |
Merge branch 'staging-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
* 'staging-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
Staging: comedi: fix integer overflow in do_insnlist_ioctl()
Revert "Staging: comedi: integer overflow in do_insnlist_ioctl()"
Staging: comedi: integer overflow in do_insnlist_ioctl()
Staging: comedi: fix signal handling in read and write
Staging: comedi: fix mmap_count
staging: comedi: fix oops for USB DAQ devices.
staging: comedi: usbduxsigma: Fixed wrong range for the analogue channel.
staging:rts_pstor:Complete scanning_done variable
staging: usbip: bugfix for deadlock
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/comedi/comedi_fops.c | 96 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/usbduxsigma.c | 7 | ||||
-rw-r--r-- | drivers/staging/rts_pstor/rtsx.c | 1 | ||||
-rw-r--r-- | drivers/staging/usbip/vhci_rx.c | 10 |
4 files changed, 84 insertions, 30 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 21d8c1c16cd8..5e78c77d5a08 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c | |||
@@ -671,7 +671,7 @@ static int do_insnlist_ioctl(struct comedi_device *dev, | |||
671 | } | 671 | } |
672 | 672 | ||
673 | insns = | 673 | insns = |
674 | kmalloc(sizeof(struct comedi_insn) * insnlist.n_insns, GFP_KERNEL); | 674 | kcalloc(insnlist.n_insns, sizeof(struct comedi_insn), GFP_KERNEL); |
675 | if (!insns) { | 675 | if (!insns) { |
676 | DPRINTK("kmalloc failed\n"); | 676 | DPRINTK("kmalloc failed\n"); |
677 | ret = -ENOMEM; | 677 | ret = -ENOMEM; |
@@ -1432,7 +1432,21 @@ static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s) | |||
1432 | return ret; | 1432 | return ret; |
1433 | } | 1433 | } |
1434 | 1434 | ||
1435 | static void comedi_unmap(struct vm_area_struct *area) | 1435 | |
1436 | static void comedi_vm_open(struct vm_area_struct *area) | ||
1437 | { | ||
1438 | struct comedi_async *async; | ||
1439 | struct comedi_device *dev; | ||
1440 | |||
1441 | async = area->vm_private_data; | ||
1442 | dev = async->subdevice->device; | ||
1443 | |||
1444 | mutex_lock(&dev->mutex); | ||
1445 | async->mmap_count++; | ||
1446 | mutex_unlock(&dev->mutex); | ||
1447 | } | ||
1448 | |||
1449 | static void comedi_vm_close(struct vm_area_struct *area) | ||
1436 | { | 1450 | { |
1437 | struct comedi_async *async; | 1451 | struct comedi_async *async; |
1438 | struct comedi_device *dev; | 1452 | struct comedi_device *dev; |
@@ -1446,15 +1460,13 @@ static void comedi_unmap(struct vm_area_struct *area) | |||
1446 | } | 1460 | } |
1447 | 1461 | ||
1448 | static struct vm_operations_struct comedi_vm_ops = { | 1462 | static struct vm_operations_struct comedi_vm_ops = { |
1449 | .close = comedi_unmap, | 1463 | .open = comedi_vm_open, |
1464 | .close = comedi_vm_close, | ||
1450 | }; | 1465 | }; |
1451 | 1466 | ||
1452 | static int comedi_mmap(struct file *file, struct vm_area_struct *vma) | 1467 | static int comedi_mmap(struct file *file, struct vm_area_struct *vma) |
1453 | { | 1468 | { |
1454 | const unsigned minor = iminor(file->f_dentry->d_inode); | 1469 | const unsigned minor = iminor(file->f_dentry->d_inode); |
1455 | struct comedi_device_file_info *dev_file_info = | ||
1456 | comedi_get_device_file_info(minor); | ||
1457 | struct comedi_device *dev = dev_file_info->device; | ||
1458 | struct comedi_async *async = NULL; | 1470 | struct comedi_async *async = NULL; |
1459 | unsigned long start = vma->vm_start; | 1471 | unsigned long start = vma->vm_start; |
1460 | unsigned long size; | 1472 | unsigned long size; |
@@ -1462,6 +1474,15 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) | |||
1462 | int i; | 1474 | int i; |
1463 | int retval; | 1475 | int retval; |
1464 | struct comedi_subdevice *s; | 1476 | struct comedi_subdevice *s; |
1477 | struct comedi_device_file_info *dev_file_info; | ||
1478 | struct comedi_device *dev; | ||
1479 | |||
1480 | dev_file_info = comedi_get_device_file_info(minor); | ||
1481 | if (dev_file_info == NULL) | ||
1482 | return -ENODEV; | ||
1483 | dev = dev_file_info->device; | ||
1484 | if (dev == NULL) | ||
1485 | return -ENODEV; | ||
1465 | 1486 | ||
1466 | mutex_lock(&dev->mutex); | 1487 | mutex_lock(&dev->mutex); |
1467 | if (!dev->attached) { | 1488 | if (!dev->attached) { |
@@ -1528,11 +1549,17 @@ static unsigned int comedi_poll(struct file *file, poll_table * wait) | |||
1528 | { | 1549 | { |
1529 | unsigned int mask = 0; | 1550 | unsigned int mask = 0; |
1530 | const unsigned minor = iminor(file->f_dentry->d_inode); | 1551 | const unsigned minor = iminor(file->f_dentry->d_inode); |
1531 | struct comedi_device_file_info *dev_file_info = | ||
1532 | comedi_get_device_file_info(minor); | ||
1533 | struct comedi_device *dev = dev_file_info->device; | ||
1534 | struct comedi_subdevice *read_subdev; | 1552 | struct comedi_subdevice *read_subdev; |
1535 | struct comedi_subdevice *write_subdev; | 1553 | struct comedi_subdevice *write_subdev; |
1554 | struct comedi_device_file_info *dev_file_info; | ||
1555 | struct comedi_device *dev; | ||
1556 | dev_file_info = comedi_get_device_file_info(minor); | ||
1557 | |||
1558 | if (dev_file_info == NULL) | ||
1559 | return -ENODEV; | ||
1560 | dev = dev_file_info->device; | ||
1561 | if (dev == NULL) | ||
1562 | return -ENODEV; | ||
1536 | 1563 | ||
1537 | mutex_lock(&dev->mutex); | 1564 | mutex_lock(&dev->mutex); |
1538 | if (!dev->attached) { | 1565 | if (!dev->attached) { |
@@ -1578,9 +1605,15 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, | |||
1578 | int n, m, count = 0, retval = 0; | 1605 | int n, m, count = 0, retval = 0; |
1579 | DECLARE_WAITQUEUE(wait, current); | 1606 | DECLARE_WAITQUEUE(wait, current); |
1580 | const unsigned minor = iminor(file->f_dentry->d_inode); | 1607 | const unsigned minor = iminor(file->f_dentry->d_inode); |
1581 | struct comedi_device_file_info *dev_file_info = | 1608 | struct comedi_device_file_info *dev_file_info; |
1582 | comedi_get_device_file_info(minor); | 1609 | struct comedi_device *dev; |
1583 | struct comedi_device *dev = dev_file_info->device; | 1610 | dev_file_info = comedi_get_device_file_info(minor); |
1611 | |||
1612 | if (dev_file_info == NULL) | ||
1613 | return -ENODEV; | ||
1614 | dev = dev_file_info->device; | ||
1615 | if (dev == NULL) | ||
1616 | return -ENODEV; | ||
1584 | 1617 | ||
1585 | if (!dev->attached) { | 1618 | if (!dev->attached) { |
1586 | DPRINTK("no driver configured on comedi%i\n", dev->minor); | 1619 | DPRINTK("no driver configured on comedi%i\n", dev->minor); |
@@ -1640,11 +1673,11 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, | |||
1640 | retval = -EAGAIN; | 1673 | retval = -EAGAIN; |
1641 | break; | 1674 | break; |
1642 | } | 1675 | } |
1676 | schedule(); | ||
1643 | if (signal_pending(current)) { | 1677 | if (signal_pending(current)) { |
1644 | retval = -ERESTARTSYS; | 1678 | retval = -ERESTARTSYS; |
1645 | break; | 1679 | break; |
1646 | } | 1680 | } |
1647 | schedule(); | ||
1648 | if (!s->busy) | 1681 | if (!s->busy) |
1649 | break; | 1682 | break; |
1650 | if (s->busy != file) { | 1683 | if (s->busy != file) { |
@@ -1683,9 +1716,15 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, | |||
1683 | int n, m, count = 0, retval = 0; | 1716 | int n, m, count = 0, retval = 0; |
1684 | DECLARE_WAITQUEUE(wait, current); | 1717 | DECLARE_WAITQUEUE(wait, current); |
1685 | const unsigned minor = iminor(file->f_dentry->d_inode); | 1718 | const unsigned minor = iminor(file->f_dentry->d_inode); |
1686 | struct comedi_device_file_info *dev_file_info = | 1719 | struct comedi_device_file_info *dev_file_info; |
1687 | comedi_get_device_file_info(minor); | 1720 | struct comedi_device *dev; |
1688 | struct comedi_device *dev = dev_file_info->device; | 1721 | dev_file_info = comedi_get_device_file_info(minor); |
1722 | |||
1723 | if (dev_file_info == NULL) | ||
1724 | return -ENODEV; | ||
1725 | dev = dev_file_info->device; | ||
1726 | if (dev == NULL) | ||
1727 | return -ENODEV; | ||
1689 | 1728 | ||
1690 | if (!dev->attached) { | 1729 | if (!dev->attached) { |
1691 | DPRINTK("no driver configured on comedi%i\n", dev->minor); | 1730 | DPRINTK("no driver configured on comedi%i\n", dev->minor); |
@@ -1741,11 +1780,11 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, | |||
1741 | retval = -EAGAIN; | 1780 | retval = -EAGAIN; |
1742 | break; | 1781 | break; |
1743 | } | 1782 | } |
1783 | schedule(); | ||
1744 | if (signal_pending(current)) { | 1784 | if (signal_pending(current)) { |
1745 | retval = -ERESTARTSYS; | 1785 | retval = -ERESTARTSYS; |
1746 | break; | 1786 | break; |
1747 | } | 1787 | } |
1748 | schedule(); | ||
1749 | if (!s->busy) { | 1788 | if (!s->busy) { |
1750 | retval = 0; | 1789 | retval = 0; |
1751 | break; | 1790 | break; |
@@ -1885,11 +1924,17 @@ ok: | |||
1885 | static int comedi_close(struct inode *inode, struct file *file) | 1924 | static int comedi_close(struct inode *inode, struct file *file) |
1886 | { | 1925 | { |
1887 | const unsigned minor = iminor(inode); | 1926 | const unsigned minor = iminor(inode); |
1888 | struct comedi_device_file_info *dev_file_info = | ||
1889 | comedi_get_device_file_info(minor); | ||
1890 | struct comedi_device *dev = dev_file_info->device; | ||
1891 | struct comedi_subdevice *s = NULL; | 1927 | struct comedi_subdevice *s = NULL; |
1892 | int i; | 1928 | int i; |
1929 | struct comedi_device_file_info *dev_file_info; | ||
1930 | struct comedi_device *dev; | ||
1931 | dev_file_info = comedi_get_device_file_info(minor); | ||
1932 | |||
1933 | if (dev_file_info == NULL) | ||
1934 | return -ENODEV; | ||
1935 | dev = dev_file_info->device; | ||
1936 | if (dev == NULL) | ||
1937 | return -ENODEV; | ||
1893 | 1938 | ||
1894 | mutex_lock(&dev->mutex); | 1939 | mutex_lock(&dev->mutex); |
1895 | 1940 | ||
@@ -1923,10 +1968,15 @@ static int comedi_close(struct inode *inode, struct file *file) | |||
1923 | static int comedi_fasync(int fd, struct file *file, int on) | 1968 | static int comedi_fasync(int fd, struct file *file, int on) |
1924 | { | 1969 | { |
1925 | const unsigned minor = iminor(file->f_dentry->d_inode); | 1970 | const unsigned minor = iminor(file->f_dentry->d_inode); |
1926 | struct comedi_device_file_info *dev_file_info = | 1971 | struct comedi_device_file_info *dev_file_info; |
1927 | comedi_get_device_file_info(minor); | 1972 | struct comedi_device *dev; |
1973 | dev_file_info = comedi_get_device_file_info(minor); | ||
1928 | 1974 | ||
1929 | struct comedi_device *dev = dev_file_info->device; | 1975 | if (dev_file_info == NULL) |
1976 | return -ENODEV; | ||
1977 | dev = dev_file_info->device; | ||
1978 | if (dev == NULL) | ||
1979 | return -ENODEV; | ||
1930 | 1980 | ||
1931 | return fasync_helper(fd, file, on, &dev->async_queue); | 1981 | return fasync_helper(fd, file, on, &dev->async_queue); |
1932 | } | 1982 | } |
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index a8fea9a91733..6144afb8cbaa 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #define DRIVER_VERSION "v0.5" | 1 | #define DRIVER_VERSION "v0.6" |
2 | #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" | 2 | #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" |
3 | #define DRIVER_DESC "Stirling/ITL USB-DUX SIGMA -- Bernd.Porr@f2s.com" | 3 | #define DRIVER_DESC "Stirling/ITL USB-DUX SIGMA -- Bernd.Porr@f2s.com" |
4 | /* | 4 | /* |
@@ -25,7 +25,7 @@ Driver: usbduxsigma | |||
25 | Description: University of Stirling USB DAQ & INCITE Technology Limited | 25 | Description: University of Stirling USB DAQ & INCITE Technology Limited |
26 | Devices: [ITL] USB-DUX (usbduxsigma.o) | 26 | Devices: [ITL] USB-DUX (usbduxsigma.o) |
27 | Author: Bernd Porr <BerndPorr@f2s.com> | 27 | Author: Bernd Porr <BerndPorr@f2s.com> |
28 | Updated: 21 Jul 2011 | 28 | Updated: 8 Nov 2011 |
29 | Status: testing | 29 | Status: testing |
30 | */ | 30 | */ |
31 | /* | 31 | /* |
@@ -44,6 +44,7 @@ Status: testing | |||
44 | * 0.3: proper vendor ID and driver name | 44 | * 0.3: proper vendor ID and driver name |
45 | * 0.4: fixed D/A voltage range | 45 | * 0.4: fixed D/A voltage range |
46 | * 0.5: various bug fixes, health check at startup | 46 | * 0.5: various bug fixes, health check at startup |
47 | * 0.6: corrected wrong input range | ||
47 | */ | 48 | */ |
48 | 49 | ||
49 | /* generates loads of debug info */ | 50 | /* generates loads of debug info */ |
@@ -175,7 +176,7 @@ Status: testing | |||
175 | /* comedi constants */ | 176 | /* comedi constants */ |
176 | static const struct comedi_lrange range_usbdux_ai_range = { 1, { | 177 | static const struct comedi_lrange range_usbdux_ai_range = { 1, { |
177 | BIP_RANGE | 178 | BIP_RANGE |
178 | (2.65) | 179 | (2.65/2.0) |
179 | } | 180 | } |
180 | }; | 181 | }; |
181 | 182 | ||
diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c index 480b0ed2e4de..115635f95024 100644 --- a/drivers/staging/rts_pstor/rtsx.c +++ b/drivers/staging/rts_pstor/rtsx.c | |||
@@ -1021,6 +1021,7 @@ static int __devinit rtsx_probe(struct pci_dev *pci, | |||
1021 | th = kthread_create(rtsx_scan_thread, dev, "rtsx-scan"); | 1021 | th = kthread_create(rtsx_scan_thread, dev, "rtsx-scan"); |
1022 | if (IS_ERR(th)) { | 1022 | if (IS_ERR(th)) { |
1023 | printk(KERN_ERR "Unable to start the device-scanning thread\n"); | 1023 | printk(KERN_ERR "Unable to start the device-scanning thread\n"); |
1024 | complete(&dev->scanning_done); | ||
1024 | quiesce_and_remove_host(dev); | 1025 | quiesce_and_remove_host(dev); |
1025 | err = PTR_ERR(th); | 1026 | err = PTR_ERR(th); |
1026 | goto errout; | 1027 | goto errout; |
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c index 09c44abb89e8..3872b8cccdcf 100644 --- a/drivers/staging/usbip/vhci_rx.c +++ b/drivers/staging/usbip/vhci_rx.c | |||
@@ -68,6 +68,7 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, | |||
68 | { | 68 | { |
69 | struct usbip_device *ud = &vdev->ud; | 69 | struct usbip_device *ud = &vdev->ud; |
70 | struct urb *urb; | 70 | struct urb *urb; |
71 | unsigned long flags; | ||
71 | 72 | ||
72 | spin_lock(&vdev->priv_lock); | 73 | spin_lock(&vdev->priv_lock); |
73 | urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); | 74 | urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); |
@@ -101,9 +102,9 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, | |||
101 | 102 | ||
102 | usbip_dbg_vhci_rx("now giveback urb %p\n", urb); | 103 | usbip_dbg_vhci_rx("now giveback urb %p\n", urb); |
103 | 104 | ||
104 | spin_lock(&the_controller->lock); | 105 | spin_lock_irqsave(&the_controller->lock, flags); |
105 | usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); | 106 | usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); |
106 | spin_unlock(&the_controller->lock); | 107 | spin_unlock_irqrestore(&the_controller->lock, flags); |
107 | 108 | ||
108 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); | 109 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); |
109 | 110 | ||
@@ -141,6 +142,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, | |||
141 | { | 142 | { |
142 | struct vhci_unlink *unlink; | 143 | struct vhci_unlink *unlink; |
143 | struct urb *urb; | 144 | struct urb *urb; |
145 | unsigned long flags; | ||
144 | 146 | ||
145 | usbip_dump_header(pdu); | 147 | usbip_dump_header(pdu); |
146 | 148 | ||
@@ -170,9 +172,9 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, | |||
170 | urb->status = pdu->u.ret_unlink.status; | 172 | urb->status = pdu->u.ret_unlink.status; |
171 | pr_info("urb->status %d\n", urb->status); | 173 | pr_info("urb->status %d\n", urb->status); |
172 | 174 | ||
173 | spin_lock(&the_controller->lock); | 175 | spin_lock_irqsave(&the_controller->lock, flags); |
174 | usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); | 176 | usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); |
175 | spin_unlock(&the_controller->lock); | 177 | spin_unlock_irqrestore(&the_controller->lock, flags); |
176 | 178 | ||
177 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, | 179 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, |
178 | urb->status); | 180 | urb->status); |