diff options
Diffstat (limited to 'drivers/hid/usbhid/hiddev.c')
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 7 |
1 files changed, 5 insertions, 2 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) | |||
265 | static int hiddev_open(struct inode *inode, struct file *file) | 265 | static 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; |
317 | bail: | 319 | bail: |
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 | ||