From: Jonathan Corbet Date: Thu, 15 May 2008 16:37:16 +0000 (-0600) Subject: Input: cdev lock_kernel() pushdown X-Git-Tag: v2.6.27-rc1~1103^2~131 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=2edbf8537edc62c9b0ef75e7025d01e8b6a48707;p=linux-2.6-omap-h63xx.git Input: cdev lock_kernel() pushdown Signed-off-by: Jonathan Corbet --- diff --git a/drivers/input/input.c b/drivers/input/input.c index 27006fc1830..408df0bd6be 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -21,6 +21,7 @@ #include #include #include +#include MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("Input core"); @@ -1588,13 +1589,17 @@ EXPORT_SYMBOL(input_unregister_handle); static int input_open_file(struct inode *inode, struct file *file) { - struct input_handler *handler = input_table[iminor(inode) >> 5]; + struct input_handler *handler; const struct file_operations *old_fops, *new_fops = NULL; int err; + lock_kernel(); /* No load-on-demand here? */ - if (!handler || !(new_fops = fops_get(handler->fops))) - return -ENODEV; + handler = input_table[iminor(inode) >> 5]; + if (!handler || !(new_fops = fops_get(handler->fops))) { + err = -ENODEV; + goto out; + } /* * That's _really_ odd. Usually NULL ->open means "nothing special", @@ -1602,7 +1607,8 @@ static int input_open_file(struct inode *inode, struct file *file) */ if (!new_fops->open) { fops_put(new_fops); - return -ENODEV; + err = -ENODEV; + goto out; } old_fops = file->f_op; file->f_op = new_fops; @@ -1614,6 +1620,8 @@ static int input_open_file(struct inode *inode, struct file *file) file->f_op = fops_get(old_fops); } fops_put(old_fops); +out: + unlock_kernel(); return err; }