diff --git a/[refs] b/[refs] index a0fb22508682..a316a5544ad0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 77554b4d1fac6a66d4e624a6e36c020a4f5b6b64 +refs/heads/master: 2f2177c8dadbcb08c14f796ac983c5475eca1bd3 diff --git a/trunk/drivers/input/input.c b/trunk/drivers/input/input.c index e2dd8858e19d..e2aad0a51826 100644 --- a/trunk/drivers/input/input.c +++ b/trunk/drivers/input/input.c @@ -1879,35 +1879,37 @@ static int input_open_file(struct inode *inode, struct file *file) const struct file_operations *old_fops, *new_fops = NULL; int err; - lock_kernel(); + err = mutex_lock_interruptible(&input_mutex); + if (err) + return err; + /* No load-on-demand here? */ handler = input_table[iminor(inode) >> 5]; - if (!handler || !(new_fops = fops_get(handler->fops))) { - err = -ENODEV; - goto out; - } + if (handler) + new_fops = fops_get(handler->fops); + + mutex_unlock(&input_mutex); /* * That's _really_ odd. Usually NULL ->open means "nothing special", * not "no device". Oh, well... */ - if (!new_fops->open) { + if (!new_fops || !new_fops->open) { fops_put(new_fops); err = -ENODEV; goto out; } + old_fops = file->f_op; file->f_op = new_fops; err = new_fops->open(inode, file); - if (err) { fops_put(file->f_op); file->f_op = fops_get(old_fops); } fops_put(old_fops); out: - unlock_kernel(); return err; }