Skip to content

Commit

Permalink
mbcs: cdev lock_kernel() pushdown
Browse files Browse the repository at this point in the history
This driver would appear to have no internal locking at all.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent 2d863e9 commit 12ead6b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/char/mbcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/mm.h>
#include <linux/uio.h>
#include <linux/mutex.h>
#include <linux/smp_lock.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/system.h>
Expand Down Expand Up @@ -382,15 +383,19 @@ static int mbcs_open(struct inode *ip, struct file *fp)
struct mbcs_soft *soft;
int minor;

lock_kernel();
minor = iminor(ip);

/* Nothing protects access to this list... */
list_for_each_entry(soft, &soft_list, list) {
if (soft->nasid == minor) {
fp->private_data = soft->cxdev;
unlock_kernel();
return 0;
}
}

unlock_kernel();
return -ENODEV;
}

Expand Down

0 comments on commit 12ead6b

Please sign in to comment.