aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/idmouse.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/idmouse.c')
-rw-r--r--drivers/usb/misc/idmouse.c8
1 files changed, 7 insertions, 1 deletions
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