aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/usbhid/hiddev.c7
-rw-r--r--drivers/media/video/dabusb.c8
-rw-r--r--drivers/staging/frontier/alphatrack.c3
-rw-r--r--drivers/staging/frontier/tranzport.c3
-rw-r--r--drivers/usb/class/cdc-wdm.c3
-rw-r--r--drivers/usb/class/usblp.c3
-rw-r--r--drivers/usb/class/usbtmc.c3
-rw-r--r--drivers/usb/core/file.c2
-rw-r--r--drivers/usb/image/mdc800.c3
-rw-r--r--drivers/usb/misc/adutux.c3
-rw-r--r--drivers/usb/misc/ftdi-elan.c15
-rw-r--r--drivers/usb/misc/idmouse.c8
-rw-r--r--drivers/usb/misc/iowarrior.c4
-rw-r--r--drivers/usb/misc/ldusb.c12
-rw-r--r--drivers/usb/misc/legousbtower.c3
-rw-r--r--drivers/usb/misc/rio500.c3
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c14
-rw-r--r--drivers/usb/misc/usblcd.c5
-rw-r--r--drivers/usb/misc/vstusb.c9
-rw-r--r--drivers/usb/usb-skeleton.c3
20 files changed, 99 insertions, 15 deletions
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 867e08433e4b..433602aed468 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -265,9 +265,10 @@ static int hiddev_release(struct inode * inode, struct file * file)
265static int hiddev_open(struct inode *inode, struct file *file) 265static int hiddev_open(struct inode *inode, struct file *file)
266{ 266{
267 struct hiddev_list *list; 267 struct hiddev_list *list;
268 int res; 268 int res, i;
269 269
270 int i = iminor(inode) - HIDDEV_MINOR_BASE; 270 lock_kernel();
271 i = iminor(inode) - HIDDEV_MINOR_BASE;
271 272
272 if (i >= HIDDEV_MINORS || i < 0 || !hiddev_table[i]) 273 if (i >= HIDDEV_MINORS || i < 0 || !hiddev_table[i])
273 return -ENODEV; 274 return -ENODEV;
@@ -313,10 +314,12 @@ static int hiddev_open(struct inode *inode, struct file *file)
313 usbhid_open(hid); 314 usbhid_open(hid);
314 } 315 }
315 316
317 unlock_kernel();
316 return 0; 318 return 0;
317bail: 319bail:
318 file->private_data = NULL; 320 file->private_data = NULL;
319 kfree(list); 321 kfree(list);
322 unlock_kernel();
320 return res; 323 return res;
321} 324}
322 325
diff --git a/drivers/media/video/dabusb.c b/drivers/media/video/dabusb.c
index 9b413a35e048..0f505086774c 100644
--- a/drivers/media/video/dabusb.c
+++ b/drivers/media/video/dabusb.c
@@ -616,10 +616,12 @@ static int dabusb_open (struct inode *inode, struct file *file)
616{ 616{
617 int devnum = iminor(inode); 617 int devnum = iminor(inode);
618 pdabusb_t s; 618 pdabusb_t s;
619 int r;
619 620
620 if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB)) 621 if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB))
621 return -EIO; 622 return -EIO;
622 623
624 lock_kernel();
623 s = &dabusb[devnum - DABUSB_MINOR]; 625 s = &dabusb[devnum - DABUSB_MINOR];
624 626
625 dbg("dabusb_open"); 627 dbg("dabusb_open");
@@ -634,6 +636,7 @@ static int dabusb_open (struct inode *inode, struct file *file)
634 msleep_interruptible(500); 636 msleep_interruptible(500);
635 637
636 if (signal_pending (current)) { 638 if (signal_pending (current)) {
639 unlock_kernel();
637 return -EAGAIN; 640 return -EAGAIN;
638 } 641 }
639 mutex_lock(&s->mutex); 642 mutex_lock(&s->mutex);
@@ -641,6 +644,7 @@ static int dabusb_open (struct inode *inode, struct file *file)
641 if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) { 644 if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) {
642 mutex_unlock(&s->mutex); 645 mutex_unlock(&s->mutex);
643 dev_err(&s->usbdev->dev, "set_interface failed\n"); 646 dev_err(&s->usbdev->dev, "set_interface failed\n");
647 unlock_kernel();
644 return -EINVAL; 648 return -EINVAL;
645 } 649 }
646 s->opened = 1; 650 s->opened = 1;
@@ -649,7 +653,9 @@ static int dabusb_open (struct inode *inode, struct file *file)
649 file->f_pos = 0; 653 file->f_pos = 0;
650 file->private_data = s; 654 file->private_data = s;
651 655
652 return nonseekable_open(inode, file); 656 r = nonseekable_open(inode, file);
657 unlock_kernel();
658 return r;
653} 659}
654 660
655static int dabusb_release (struct inode *inode, struct file *file) 661static int dabusb_release (struct inode *inode, struct file *file)
diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c
index 15aed87fe1bb..e2f82f0dbad8 100644
--- a/drivers/staging/frontier/alphatrack.c
+++ b/drivers/staging/frontier/alphatrack.c
@@ -41,6 +41,7 @@
41#include <linux/mutex.h> 41#include <linux/mutex.h>
42 42
43#include <linux/uaccess.h> 43#include <linux/uaccess.h>
44#include <linux/smp_lock.h>
44#include <linux/input.h> 45#include <linux/input.h>
45#include <linux/usb.h> 46#include <linux/usb.h>
46#include <linux/poll.h> 47#include <linux/poll.h>
@@ -325,6 +326,7 @@ static int usb_alphatrack_open(struct inode *inode, struct file *file)
325 int retval = 0; 326 int retval = 0;
326 struct usb_interface *interface; 327 struct usb_interface *interface;
327 328
329 lock_kernel();
328 nonseekable_open(inode, file); 330 nonseekable_open(inode, file);
329 subminor = iminor(inode); 331 subminor = iminor(inode);
330 332
@@ -394,6 +396,7 @@ unlock_exit:
394 396
395unlock_disconnect_exit: 397unlock_disconnect_exit:
396 mutex_unlock(&disconnect_mutex); 398 mutex_unlock(&disconnect_mutex);
399 unlock_kernel();
397 400
398 return retval; 401 return retval;
399} 402}
diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c
index ef8fcc8c67bd..1d3f7dc90f4f 100644
--- a/drivers/staging/frontier/tranzport.c
+++ b/drivers/staging/frontier/tranzport.c
@@ -40,6 +40,7 @@
40#include <linux/mutex.h> 40#include <linux/mutex.h>
41 41
42#include <linux/uaccess.h> 42#include <linux/uaccess.h>
43#include <linux/smp_lock.h>
43#include <linux/input.h> 44#include <linux/input.h>
44#include <linux/usb.h> 45#include <linux/usb.h>
45#include <linux/poll.h> 46#include <linux/poll.h>
@@ -343,6 +344,7 @@ static int usb_tranzport_open(struct inode *inode, struct file *file)
343 int retval = 0; 344 int retval = 0;
344 struct usb_interface *interface; 345 struct usb_interface *interface;
345 346
347 lock_kernel();
346 nonseekable_open(inode, file); 348 nonseekable_open(inode, file);
347 subminor = iminor(inode); 349 subminor = iminor(inode);
348 350
@@ -413,6 +415,7 @@ unlock_exit:
413 415
414unlock_disconnect_exit: 416unlock_disconnect_exit:
415 mutex_unlock(&disconnect_mutex); 417 mutex_unlock(&disconnect_mutex);
418 unlock_kernel();
416 419
417 return retval; 420 return retval;
418} 421}
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 18aafcb08fc8..b75a3d8bb02f 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -19,6 +19,7 @@
19#include <linux/uaccess.h> 19#include <linux/uaccess.h>
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <linux/poll.h> 21#include <linux/poll.h>
22#include <linux/smp_lock.h>
22#include <linux/usb.h> 23#include <linux/usb.h>
23#include <linux/usb/cdc.h> 24#include <linux/usb/cdc.h>
24#include <asm/byteorder.h> 25#include <asm/byteorder.h>
@@ -516,6 +517,7 @@ static int wdm_open(struct inode *inode, struct file *file)
516 struct usb_interface *intf; 517 struct usb_interface *intf;
517 struct wdm_device *desc; 518 struct wdm_device *desc;
518 519
520 lock_kernel();
519 mutex_lock(&wdm_mutex); 521 mutex_lock(&wdm_mutex);
520 intf = usb_find_interface(&wdm_driver, minor); 522 intf = usb_find_interface(&wdm_driver, minor);
521 if (!intf) 523 if (!intf)
@@ -548,6 +550,7 @@ static int wdm_open(struct inode *inode, struct file *file)
548 usb_autopm_put_interface(desc->intf); 550 usb_autopm_put_interface(desc->intf);
549out: 551out:
550 mutex_unlock(&wdm_mutex); 552 mutex_unlock(&wdm_mutex);
553 unlock_kernel();
551 return rv; 554 return rv;
552} 555}
553 556
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 93b5f85d7ceb..d53f9499f936 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -56,6 +56,7 @@
56#include <linux/slab.h> 56#include <linux/slab.h>
57#include <linux/lp.h> 57#include <linux/lp.h>
58#include <linux/mutex.h> 58#include <linux/mutex.h>
59#include <linux/smp_lock.h>
59#undef DEBUG 60#undef DEBUG
60#include <linux/usb.h> 61#include <linux/usb.h>
61 62
@@ -395,6 +396,7 @@ static int usblp_open(struct inode *inode, struct file *file)
395 if (minor < 0) 396 if (minor < 0)
396 return -ENODEV; 397 return -ENODEV;
397 398
399 lock_kernel();
398 mutex_lock (&usblp_mutex); 400 mutex_lock (&usblp_mutex);
399 401
400 retval = -ENODEV; 402 retval = -ENODEV;
@@ -434,6 +436,7 @@ static int usblp_open(struct inode *inode, struct file *file)
434 } 436 }
435out: 437out:
436 mutex_unlock (&usblp_mutex); 438 mutex_unlock (&usblp_mutex);
439 unlock_kernel();
437 return retval; 440 return retval;
438} 441}
439 442
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 8588c0937a89..426bfc72b9b4 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -26,6 +26,7 @@
26#include <linux/uaccess.h> 26#include <linux/uaccess.h>
27#include <linux/kref.h> 27#include <linux/kref.h>
28#include <linux/mutex.h> 28#include <linux/mutex.h>
29#include <linux/smp_lock.h>
29#include <linux/usb.h> 30#include <linux/usb.h>
30#include <linux/usb/tmc.h> 31#include <linux/usb/tmc.h>
31 32
@@ -113,6 +114,7 @@ static int usbtmc_open(struct inode *inode, struct file *filp)
113 struct usbtmc_device_data *data; 114 struct usbtmc_device_data *data;
114 int retval = 0; 115 int retval = 0;
115 116
117 lock_kernel();
116 intf = usb_find_interface(&usbtmc_driver, iminor(inode)); 118 intf = usb_find_interface(&usbtmc_driver, iminor(inode));
117 if (!intf) { 119 if (!intf) {
118 printk(KERN_ERR KBUILD_MODNAME 120 printk(KERN_ERR KBUILD_MODNAME
@@ -128,6 +130,7 @@ static int usbtmc_open(struct inode *inode, struct file *filp)
128 filp->private_data = data; 130 filp->private_data = data;
129 131
130exit: 132exit:
133 unlock_kernel();
131 return retval; 134 return retval;
132} 135}
133 136
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index bfc6c2eea647..c3536f151f02 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -34,7 +34,6 @@ static int usb_open(struct inode * inode, struct file * file)
34 int err = -ENODEV; 34 int err = -ENODEV;
35 const struct file_operations *old_fops, *new_fops = NULL; 35 const struct file_operations *old_fops, *new_fops = NULL;
36 36
37 lock_kernel();
38 down_read(&minor_rwsem); 37 down_read(&minor_rwsem);
39 c = usb_minors[minor]; 38 c = usb_minors[minor];
40 39
@@ -53,7 +52,6 @@ static int usb_open(struct inode * inode, struct file * file)
53 fops_put(old_fops); 52 fops_put(old_fops);
54 done: 53 done:
55 up_read(&minor_rwsem); 54 up_read(&minor_rwsem);
56 unlock_kernel();
57 return err; 55 return err;
58} 56}
59 57
diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
index e192e8f7c560..dce4f7b69ac3 100644
--- a/drivers/usb/image/mdc800.c
+++ b/drivers/usb/image/mdc800.c
@@ -96,6 +96,7 @@
96#include <linux/module.h> 96#include <linux/module.h>
97#include <linux/wait.h> 97#include <linux/wait.h>
98#include <linux/mutex.h> 98#include <linux/mutex.h>
99#include <linux/smp_lock.h>
99 100
100#include <linux/usb.h> 101#include <linux/usb.h>
101#include <linux/fs.h> 102#include <linux/fs.h>
@@ -622,6 +623,7 @@ static int mdc800_device_open (struct inode* inode, struct file *file)
622 int retval=0; 623 int retval=0;
623 int errn=0; 624 int errn=0;
624 625
626 lock_kernel();
625 mutex_lock(&mdc800->io_lock); 627 mutex_lock(&mdc800->io_lock);
626 628
627 if (mdc800->state == NOT_CONNECTED) 629 if (mdc800->state == NOT_CONNECTED)
@@ -660,6 +662,7 @@ static int mdc800_device_open (struct inode* inode, struct file *file)
660 662
661error_out: 663error_out:
662 mutex_unlock(&mdc800->io_lock); 664 mutex_unlock(&mdc800->io_lock);
665 unlock_kernel();
663 return errn; 666 return errn;
664} 667}
665 668
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index 306e97825b36..ac8ad91c2dac 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -25,6 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/usb.h> 26#include <linux/usb.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/smp_lock.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29 30
30#ifdef CONFIG_USB_DEBUG 31#ifdef CONFIG_USB_DEBUG
@@ -274,6 +275,7 @@ static int adu_open(struct inode *inode, struct file *file)
274 275
275 dbg(2,"%s : enter", __func__); 276 dbg(2,"%s : enter", __func__);
276 277
278 lock_kernel();
277 subminor = iminor(inode); 279 subminor = iminor(inode);
278 280
279 if ((retval = mutex_lock_interruptible(&adutux_mutex))) { 281 if ((retval = mutex_lock_interruptible(&adutux_mutex))) {
@@ -332,6 +334,7 @@ static int adu_open(struct inode *inode, struct file *file)
332exit_no_device: 334exit_no_device:
333 mutex_unlock(&adutux_mutex); 335 mutex_unlock(&adutux_mutex);
334exit_no_lock: 336exit_no_lock:
337 unlock_kernel();
335 dbg(2,"%s : leave, return value %d ", __func__, retval); 338 dbg(2,"%s : leave, return value %d ", __func__, retval);
336 return retval; 339 return retval;
337} 340}
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index f21bf5160f83..32c47fbee288 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -45,6 +45,7 @@
45#include <linux/module.h> 45#include <linux/module.h>
46#include <linux/kref.h> 46#include <linux/kref.h>
47#include <linux/mutex.h> 47#include <linux/mutex.h>
48#include <linux/smp_lock.h>
48#include <asm/uaccess.h> 49#include <asm/uaccess.h>
49#include <linux/usb.h> 50#include <linux/usb.h>
50#include <linux/workqueue.h> 51#include <linux/workqueue.h>
@@ -623,22 +624,30 @@ static void ftdi_elan_status_work(struct work_struct *work)
623*/ 624*/
624static int ftdi_elan_open(struct inode *inode, struct file *file) 625static int ftdi_elan_open(struct inode *inode, struct file *file)
625{ 626{
626 int subminor = iminor(inode); 627 int subminor;
627 struct usb_interface *interface = usb_find_interface(&ftdi_elan_driver, 628 struct usb_interface *interface;
628 subminor); 629
630 lock_kernel();
631 subminor = iminor(inode);
632 interface = usb_find_interface(&ftdi_elan_driver, subminor);
633
629 if (!interface) { 634 if (!interface) {
635 unlock_kernel();
630 printk(KERN_ERR "can't find device for minor %d\n", subminor); 636 printk(KERN_ERR "can't find device for minor %d\n", subminor);
631 return -ENODEV; 637 return -ENODEV;
632 } else { 638 } else {
633 struct usb_ftdi *ftdi = usb_get_intfdata(interface); 639 struct usb_ftdi *ftdi = usb_get_intfdata(interface);
634 if (!ftdi) { 640 if (!ftdi) {
641 unlock_kernel();
635 return -ENODEV; 642 return -ENODEV;
636 } else { 643 } else {
637 if (down_interruptible(&ftdi->sw_lock)) { 644 if (down_interruptible(&ftdi->sw_lock)) {
645 unlock_kernel();
638 return -EINTR; 646 return -EINTR;
639 } else { 647 } else {
640 ftdi_elan_get_kref(ftdi); 648 ftdi_elan_get_kref(ftdi);
641 file->private_data = ftdi; 649 file->private_data = ftdi;
650 unlock_kernel();
642 return 0; 651 return 0;
643 } 652 }
644 } 653 }
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index a54c3cb804ce..68df9ac76699 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -24,6 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/completion.h> 25#include <linux/completion.h>
26#include <linux/mutex.h> 26#include <linux/mutex.h>
27#include <linux/smp_lock.h>
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28#include <linux/usb.h> 29#include <linux/usb.h>
29 30
@@ -226,16 +227,20 @@ static int idmouse_open(struct inode *inode, struct file *file)
226 struct usb_interface *interface; 227 struct usb_interface *interface;
227 int result; 228 int result;
228 229
230 lock_kernel();
229 /* get the interface from minor number and driver information */ 231 /* get the interface from minor number and driver information */
230 interface = usb_find_interface (&idmouse_driver, iminor (inode)); 232 interface = usb_find_interface (&idmouse_driver, iminor (inode));
231 if (!interface) 233 if (!interface) {
234 unlock_kernel();
232 return -ENODEV; 235 return -ENODEV;
236 }
233 237
234 mutex_lock(&open_disc_mutex); 238 mutex_lock(&open_disc_mutex);
235 /* get the device information block from the interface */ 239 /* get the device information block from the interface */
236 dev = usb_get_intfdata(interface); 240 dev = usb_get_intfdata(interface);
237 if (!dev) { 241 if (!dev) {
238 mutex_unlock(&open_disc_mutex); 242 mutex_unlock(&open_disc_mutex);
243 unlock_kernel();
239 return -ENODEV; 244 return -ENODEV;
240 } 245 }
241 246
@@ -272,6 +277,7 @@ error:
272 277
273 /* unlock this device */ 278 /* unlock this device */
274 mutex_unlock(&dev->lock); 279 mutex_unlock(&dev->lock);
280 unlock_kernel();
275 return result; 281 return result;
276} 282}
277 283
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 5206423211fb..d3c852363883 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -602,10 +602,12 @@ static int iowarrior_open(struct inode *inode, struct file *file)
602 602
603 dbg("%s", __func__); 603 dbg("%s", __func__);
604 604
605 lock_kernel();
605 subminor = iminor(inode); 606 subminor = iminor(inode);
606 607
607 interface = usb_find_interface(&iowarrior_driver, subminor); 608 interface = usb_find_interface(&iowarrior_driver, subminor);
608 if (!interface) { 609 if (!interface) {
610 unlock_kernel();
609 err("%s - error, can't find device for minor %d", __func__, 611 err("%s - error, can't find device for minor %d", __func__,
610 subminor); 612 subminor);
611 return -ENODEV; 613 return -ENODEV;
@@ -615,6 +617,7 @@ static int iowarrior_open(struct inode *inode, struct file *file)
615 dev = usb_get_intfdata(interface); 617 dev = usb_get_intfdata(interface);
616 if (!dev) { 618 if (!dev) {
617 mutex_unlock(&iowarrior_open_disc_lock); 619 mutex_unlock(&iowarrior_open_disc_lock);
620 unlock_kernel();
618 return -ENODEV; 621 return -ENODEV;
619 } 622 }
620 623
@@ -641,6 +644,7 @@ static int iowarrior_open(struct inode *inode, struct file *file)
641 644
642out: 645out:
643 mutex_unlock(&dev->mutex); 646 mutex_unlock(&dev->mutex);
647 unlock_kernel();
644 return retval; 648 return retval;
645} 649}
646 650
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 7c0bd13eccb2..8de32df5978a 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -33,6 +33,7 @@
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36#include <linux/smp_lock.h>
36 37
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
38#include <linux/input.h> 39#include <linux/input.h>
@@ -296,12 +297,14 @@ static int ld_usb_open(struct inode *inode, struct file *file)
296 int retval; 297 int retval;
297 struct usb_interface *interface; 298 struct usb_interface *interface;
298 299
300 lock_kernel();
299 nonseekable_open(inode, file); 301 nonseekable_open(inode, file);
300 subminor = iminor(inode); 302 subminor = iminor(inode);
301 303
302 interface = usb_find_interface(&ld_usb_driver, subminor); 304 interface = usb_find_interface(&ld_usb_driver, subminor);
303 305
304 if (!interface) { 306 if (!interface) {
307 unlock_kernel();
305 err("%s - error, can't find device for minor %d\n", 308 err("%s - error, can't find device for minor %d\n",
306 __func__, subminor); 309 __func__, subminor);
307 return -ENODEV; 310 return -ENODEV;
@@ -309,12 +312,16 @@ static int ld_usb_open(struct inode *inode, struct file *file)
309 312
310 dev = usb_get_intfdata(interface); 313 dev = usb_get_intfdata(interface);
311 314
312 if (!dev) 315 if (!dev) {
316 unlock_kernel();
313 return -ENODEV; 317 return -ENODEV;
318 }
314 319
315 /* lock this device */ 320 /* lock this device */
316 if (mutex_lock_interruptible(&dev->mutex)) 321 if (mutex_lock_interruptible(&dev->mutex)) {
322 unlock_kernel();
317 return -ERESTARTSYS; 323 return -ERESTARTSYS;
324 }
318 325
319 /* allow opening only once */ 326 /* allow opening only once */
320 if (dev->open_count) { 327 if (dev->open_count) {
@@ -353,6 +360,7 @@ static int ld_usb_open(struct inode *inode, struct file *file)
353 360
354unlock_exit: 361unlock_exit:
355 mutex_unlock(&dev->mutex); 362 mutex_unlock(&dev->mutex);
363 unlock_kernel();
356 364
357 return retval; 365 return retval;
358} 366}
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 3d4378fb4410..94e1b84134dd 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -82,6 +82,7 @@
82#include <linux/module.h> 82#include <linux/module.h>
83#include <linux/completion.h> 83#include <linux/completion.h>
84#include <linux/mutex.h> 84#include <linux/mutex.h>
85#include <linux/smp_lock.h>
85#include <asm/uaccess.h> 86#include <asm/uaccess.h>
86#include <linux/usb.h> 87#include <linux/usb.h>
87#include <linux/poll.h> 88#include <linux/poll.h>
@@ -345,6 +346,7 @@ static int tower_open (struct inode *inode, struct file *file)
345 346
346 dbg(2, "%s: enter", __func__); 347 dbg(2, "%s: enter", __func__);
347 348
349 lock_kernel();
348 nonseekable_open(inode, file); 350 nonseekable_open(inode, file);
349 subminor = iminor(inode); 351 subminor = iminor(inode);
350 352
@@ -430,6 +432,7 @@ unlock_exit:
430 mutex_unlock(&dev->lock); 432 mutex_unlock(&dev->lock);
431 433
432exit: 434exit:
435 unlock_kernel();
433 dbg(2, "%s: leave, return value %d ", __func__, retval); 436 dbg(2, "%s: leave, return value %d ", __func__, retval);
434 437
435 return retval; 438 return retval;
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c
index 17e4eecaee73..47ce46bb5b01 100644
--- a/drivers/usb/misc/rio500.c
+++ b/drivers/usb/misc/rio500.c
@@ -77,7 +77,7 @@ static struct rio_usb_data rio_instance;
77static int open_rio(struct inode *inode, struct file *file) 77static int open_rio(struct inode *inode, struct file *file)
78{ 78{
79 struct rio_usb_data *rio = &rio_instance; 79 struct rio_usb_data *rio = &rio_instance;
80 80 lock_kernel();
81 mutex_lock(&(rio->lock)); 81 mutex_lock(&(rio->lock));
82 82
83 if (rio->isopen || !rio->present) { 83 if (rio->isopen || !rio->present) {
@@ -91,6 +91,7 @@ static int open_rio(struct inode *inode, struct file *file)
91 mutex_unlock(&(rio->lock)); 91 mutex_unlock(&(rio->lock));
92 92
93 dev_info(&rio->rio_dev->dev, "Rio opened.\n"); 93 dev_info(&rio->rio_dev->dev, "Rio opened.\n");
94 unlock_kernel();
94 95
95 return 0; 96 return 0;
96} 97}
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index bb0b315b521d..3991655f8f09 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -2416,21 +2416,28 @@ sisusb_open(struct inode *inode, struct file *file)
2416 struct usb_interface *interface; 2416 struct usb_interface *interface;
2417 int subminor = iminor(inode); 2417 int subminor = iminor(inode);
2418 2418
2419 if (!(interface = usb_find_interface(&sisusb_driver, subminor))) 2419 lock_kernel();
2420 if (!(interface = usb_find_interface(&sisusb_driver, subminor))) {
2421 unlock_kernel();
2420 return -ENODEV; 2422 return -ENODEV;
2423 }
2421 2424
2422 if (!(sisusb = usb_get_intfdata(interface))) 2425 if (!(sisusb = usb_get_intfdata(interface))) {
2426 unlock_kernel();
2423 return -ENODEV; 2427 return -ENODEV;
2428 }
2424 2429
2425 mutex_lock(&sisusb->lock); 2430 mutex_lock(&sisusb->lock);
2426 2431
2427 if (!sisusb->present || !sisusb->ready) { 2432 if (!sisusb->present || !sisusb->ready) {
2428 mutex_unlock(&sisusb->lock); 2433 mutex_unlock(&sisusb->lock);
2434 unlock_kernel();
2429 return -ENODEV; 2435 return -ENODEV;
2430 } 2436 }
2431 2437
2432 if (sisusb->isopen) { 2438 if (sisusb->isopen) {
2433 mutex_unlock(&sisusb->lock); 2439 mutex_unlock(&sisusb->lock);
2440 unlock_kernel();
2434 return -EBUSY; 2441 return -EBUSY;
2435 } 2442 }
2436 2443
@@ -2439,11 +2446,13 @@ sisusb_open(struct inode *inode, struct file *file)
2439 if (sisusb_init_gfxdevice(sisusb, 0)) { 2446 if (sisusb_init_gfxdevice(sisusb, 0)) {
2440 mutex_unlock(&sisusb->lock); 2447 mutex_unlock(&sisusb->lock);
2441 dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n"); 2448 dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n");
2449 unlock_kernel();
2442 return -EIO; 2450 return -EIO;
2443 } 2451 }
2444 } else { 2452 } else {
2445 mutex_unlock(&sisusb->lock); 2453 mutex_unlock(&sisusb->lock);
2446 dev_err(&sisusb->sisusb_dev->dev, "Device not attached to USB 2.0 hub\n"); 2454 dev_err(&sisusb->sisusb_dev->dev, "Device not attached to USB 2.0 hub\n");
2455 unlock_kernel();
2447 return -EIO; 2456 return -EIO;
2448 } 2457 }
2449 } 2458 }
@@ -2456,6 +2465,7 @@ sisusb_open(struct inode *inode, struct file *file)
2456 file->private_data = sisusb; 2465 file->private_data = sisusb;
2457 2466
2458 mutex_unlock(&sisusb->lock); 2467 mutex_unlock(&sisusb->lock);
2468 unlock_kernel();
2459 2469
2460 return 0; 2470 return 0;
2461} 2471}
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index 499d7508be9a..90aede90553e 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -74,10 +74,12 @@ static int lcd_open(struct inode *inode, struct file *file)
74 struct usb_interface *interface; 74 struct usb_interface *interface;
75 int subminor, r; 75 int subminor, r;
76 76
77 lock_kernel();
77 subminor = iminor(inode); 78 subminor = iminor(inode);
78 79
79 interface = usb_find_interface(&lcd_driver, subminor); 80 interface = usb_find_interface(&lcd_driver, subminor);
80 if (!interface) { 81 if (!interface) {
82 unlock_kernel();
81 err ("USBLCD: %s - error, can't find device for minor %d", 83 err ("USBLCD: %s - error, can't find device for minor %d",
82 __func__, subminor); 84 __func__, subminor);
83 return -ENODEV; 85 return -ENODEV;
@@ -87,6 +89,7 @@ static int lcd_open(struct inode *inode, struct file *file)
87 dev = usb_get_intfdata(interface); 89 dev = usb_get_intfdata(interface);
88 if (!dev) { 90 if (!dev) {
89 mutex_unlock(&open_disc_mutex); 91 mutex_unlock(&open_disc_mutex);
92 unlock_kernel();
90 return -ENODEV; 93 return -ENODEV;
91 } 94 }
92 95
@@ -98,11 +101,13 @@ static int lcd_open(struct inode *inode, struct file *file)
98 r = usb_autopm_get_interface(interface); 101 r = usb_autopm_get_interface(interface);
99 if (r < 0) { 102 if (r < 0) {
100 kref_put(&dev->kref, lcd_delete); 103 kref_put(&dev->kref, lcd_delete);
104 unlock_kernel();
101 return r; 105 return r;
102 } 106 }
103 107
104 /* save our object in the file's private structure */ 108 /* save our object in the file's private structure */
105 file->private_data = dev; 109 file->private_data = dev;
110 unlock_kernel();
106 111
107 return 0; 112 return 0;
108} 113}
diff --git a/drivers/usb/misc/vstusb.c b/drivers/usb/misc/vstusb.c
index 874c81bb27b9..b787b25d4cc4 100644
--- a/drivers/usb/misc/vstusb.c
+++ b/drivers/usb/misc/vstusb.c
@@ -27,6 +27,7 @@
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30#include <linux/smp_lock.h>
30#include <linux/uaccess.h> 31#include <linux/uaccess.h>
31#include <linux/usb.h> 32#include <linux/usb.h>
32 33
@@ -103,19 +104,23 @@ static int vstusb_open(struct inode *inode, struct file *file)
103 struct vstusb_device *vstdev; 104 struct vstusb_device *vstdev;
104 struct usb_interface *interface; 105 struct usb_interface *interface;
105 106
107 lock_kernel();
106 interface = usb_find_interface(&vstusb_driver, iminor(inode)); 108 interface = usb_find_interface(&vstusb_driver, iminor(inode));
107 109
108 if (!interface) { 110 if (!interface) {
109 printk(KERN_ERR KBUILD_MODNAME 111 printk(KERN_ERR KBUILD_MODNAME
110 ": %s - error, can't find device for minor %d\n", 112 ": %s - error, can't find device for minor %d\n",
111 __func__, iminor(inode)); 113 __func__, iminor(inode));
114 unlock_kernel();
112 return -ENODEV; 115 return -ENODEV;
113 } 116 }
114 117
115 vstdev = usb_get_intfdata(interface); 118 vstdev = usb_get_intfdata(interface);
116 119
117 if (!vstdev) 120 if (!vstdev) {
121 unlock_kernel();
118 return -ENODEV; 122 return -ENODEV;
123 }
119 124
120 /* lock this device */ 125 /* lock this device */
121 mutex_lock(&vstdev->lock); 126 mutex_lock(&vstdev->lock);
@@ -123,6 +128,7 @@ static int vstusb_open(struct inode *inode, struct file *file)
123 /* can only open one time */ 128 /* can only open one time */
124 if ((!vstdev->present) || (vstdev->isopen)) { 129 if ((!vstdev->present) || (vstdev->isopen)) {
125 mutex_unlock(&vstdev->lock); 130 mutex_unlock(&vstdev->lock);
131 unlock_kernel();
126 return -EBUSY; 132 return -EBUSY;
127 } 133 }
128 134
@@ -137,6 +143,7 @@ static int vstusb_open(struct inode *inode, struct file *file)
137 dev_dbg(&vstdev->usb_dev->dev, "%s: opened\n", __func__); 143 dev_dbg(&vstdev->usb_dev->dev, "%s: opened\n", __func__);
138 144
139 mutex_unlock(&vstdev->lock); 145 mutex_unlock(&vstdev->lock);
146 unlock_kernel();
140 147
141 return 0; 148 return 0;
142} 149}
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index 61522787f39c..e94176bfd272 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -18,6 +18,7 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/kref.h> 20#include <linux/kref.h>
21#include <linux/smp_lock.h>
21#include <linux/uaccess.h> 22#include <linux/uaccess.h>
22#include <linux/usb.h> 23#include <linux/usb.h>
23#include <linux/mutex.h> 24#include <linux/mutex.h>
@@ -90,6 +91,7 @@ static int skel_open(struct inode *inode, struct file *file)
90 int subminor; 91 int subminor;
91 int retval = 0; 92 int retval = 0;
92 93
94 lock_kernel();
93 subminor = iminor(inode); 95 subminor = iminor(inode);
94 96
95 interface = usb_find_interface(&skel_driver, subminor); 97 interface = usb_find_interface(&skel_driver, subminor);
@@ -135,6 +137,7 @@ static int skel_open(struct inode *inode, struct file *file)
135 mutex_unlock(&dev->io_mutex); 137 mutex_unlock(&dev->io_mutex);
136 138
137exit: 139exit:
140 unlock_kernel();
138 return retval; 141 return retval;
139} 142}
140 143