diff options
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r-- | drivers/hid/hidraw.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index a3866b5c0c4..8a4b32dca9f 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -218,9 +218,13 @@ static int hidraw_release(struct inode * inode, struct file * file) unsigned int minor = iminor(inode); struct hidraw *dev; struct hidraw_list *list = file->private_data; + int ret; - if (!hidraw_table[minor]) - return -ENODEV; + mutex_lock(&minors_lock); + if (!hidraw_table[minor]) { + ret = -ENODEV; + goto unlock; + } list_del(&list->node); dev = hidraw_table[minor]; @@ -233,10 +237,12 @@ static int hidraw_release(struct inode * inode, struct file * file) kfree(list->hidraw); } } - kfree(list); + ret = 0; +unlock: + mutex_unlock(&minors_lock); - return 0; + return ret; } static long hidraw_ioctl(struct file *file, unsigned int cmd, @@ -340,6 +346,7 @@ static const struct file_operations hidraw_ops = { .open = hidraw_open, .release = hidraw_release, .unlocked_ioctl = hidraw_ioctl, + .llseek = noop_llseek, }; void hidraw_report_event(struct hid_device *hid, u8 *data, int len) |