diff options
author | Jonathan Corbet <corbet@lwn.net> | 2008-05-15 13:24:23 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2008-06-20 16:05:48 -0400 |
commit | 12ead6b098b65dd21d3ed4fcccf20025dbe86cc2 (patch) | |
tree | a45d63c7e0d2c60949b6ffe5cbc19c2b38d20968 /drivers/char/mbcs.c | |
parent | 2d863e92ec1b1deb8167d7f5266f754f258e876a (diff) |
mbcs: cdev lock_kernel() pushdown
This driver would appear to have no internal locking at all.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/char/mbcs.c')
-rw-r--r-- | drivers/char/mbcs.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index f4716ad7348a..acd8e9ed474a 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
25 | #include <linux/uio.h> | 25 | #include <linux/uio.h> |
26 | #include <linux/mutex.h> | 26 | #include <linux/mutex.h> |
27 | #include <linux/smp_lock.h> | ||
27 | #include <asm/io.h> | 28 | #include <asm/io.h> |
28 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
29 | #include <asm/system.h> | 30 | #include <asm/system.h> |
@@ -382,15 +383,19 @@ static int mbcs_open(struct inode *ip, struct file *fp) | |||
382 | struct mbcs_soft *soft; | 383 | struct mbcs_soft *soft; |
383 | int minor; | 384 | int minor; |
384 | 385 | ||
386 | lock_kernel(); | ||
385 | minor = iminor(ip); | 387 | minor = iminor(ip); |
386 | 388 | ||
389 | /* Nothing protects access to this list... */ | ||
387 | list_for_each_entry(soft, &soft_list, list) { | 390 | list_for_each_entry(soft, &soft_list, list) { |
388 | if (soft->nasid == minor) { | 391 | if (soft->nasid == minor) { |
389 | fp->private_data = soft->cxdev; | 392 | fp->private_data = soft->cxdev; |
393 | unlock_kernel(); | ||
390 | return 0; | 394 | return 0; |
391 | } | 395 | } |
392 | } | 396 | } |
393 | 397 | ||
398 | unlock_kernel(); | ||
394 | return -ENODEV; | 399 | return -ENODEV; |
395 | } | 400 | } |
396 | 401 | ||