Commit f9c8154f367d471f1af56742fe8534f8458adb98
Committed by
Jonathan Corbet
1 parent
dca67e9d3d
Exists in
master
and in
7 other branches
mousedev: BKL pushdown
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Showing 1 changed file with 10 additions and 2 deletions Side-by-side Diff
drivers/input/mousedev.c
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | #define MOUSEDEV_MIX 31 |
15 | 15 | |
16 | 16 | #include <linux/slab.h> |
17 | +#include <linux/smp_lock.h> | |
17 | 18 | #include <linux/poll.h> |
18 | 19 | #include <linux/module.h> |
19 | 20 | #include <linux/init.h> |
20 | 21 | |
21 | 22 | |
22 | 23 | |
23 | 24 | |
... | ... | @@ -545,16 +546,21 @@ |
545 | 546 | if (i >= MOUSEDEV_MINORS) |
546 | 547 | return -ENODEV; |
547 | 548 | |
549 | + lock_kernel(); | |
548 | 550 | error = mutex_lock_interruptible(&mousedev_table_mutex); |
549 | - if (error) | |
551 | + if (error) { | |
552 | + unlock_kernel(); | |
550 | 553 | return error; |
554 | + } | |
551 | 555 | mousedev = mousedev_table[i]; |
552 | 556 | if (mousedev) |
553 | 557 | get_device(&mousedev->dev); |
554 | 558 | mutex_unlock(&mousedev_table_mutex); |
555 | 559 | |
556 | - if (!mousedev) | |
560 | + if (!mousedev) { | |
561 | + unlock_kernel(); | |
557 | 562 | return -ENODEV; |
563 | + } | |
558 | 564 | |
559 | 565 | client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL); |
560 | 566 | if (!client) { |
... | ... | @@ -573,6 +579,7 @@ |
573 | 579 | goto err_free_client; |
574 | 580 | |
575 | 581 | file->private_data = client; |
582 | + unlock_kernel(); | |
576 | 583 | return 0; |
577 | 584 | |
578 | 585 | err_free_client: |
... | ... | @@ -580,6 +587,7 @@ |
580 | 587 | kfree(client); |
581 | 588 | err_put_mousedev: |
582 | 589 | put_device(&mousedev->dev); |
590 | + unlock_kernel(); | |
583 | 591 | return error; |
584 | 592 | } |
585 | 593 |