summaryrefslogtreecommitdiff
path: root/drivers/input/mousedev.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2008-05-20 21:16:20 +0400
committerJonathan Corbet <corbet@lwn.net>2008-07-03 01:06:23 +0400
commitf9c8154f367d471f1af56742fe8534f8458adb98 (patch)
tree6625c2e4a82d5f772545ec606434d616a6ae3797 /drivers/input/mousedev.c
parentdca67e9d3db27b090259b696e1166615f40099e2 (diff)
downloadlinux-f9c8154f367d471f1af56742fe8534f8458adb98.tar.xz
mousedev: BKL pushdown
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/input/mousedev.c')
-rw-r--r--drivers/input/mousedev.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index b989748598ae..8137e50ded87 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -14,6 +14,7 @@
#define MOUSEDEV_MIX 31
#include <linux/slab.h>
+#include <linux/smp_lock.h>
#include <linux/poll.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -545,16 +546,21 @@ static int mousedev_open(struct inode *inode, struct file *file)
if (i >= MOUSEDEV_MINORS)
return -ENODEV;
+ lock_kernel();
error = mutex_lock_interruptible(&mousedev_table_mutex);
- if (error)
+ if (error) {
+ unlock_kernel();
return error;
+ }
mousedev = mousedev_table[i];
if (mousedev)
get_device(&mousedev->dev);
mutex_unlock(&mousedev_table_mutex);
- if (!mousedev)
+ if (!mousedev) {
+ unlock_kernel();
return -ENODEV;
+ }
client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL);
if (!client) {
@@ -573,6 +579,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
goto err_free_client;
file->private_data = client;
+ unlock_kernel();
return 0;
err_free_client:
@@ -580,6 +587,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
kfree(client);
err_put_mousedev:
put_device(&mousedev->dev);
+ unlock_kernel();
return error;
}