Commit 12ead6b0 authored by Jonathan Corbet's avatar Jonathan Corbet

mbcs: cdev lock_kernel() pushdown

This driver would appear to have no internal locking at all.
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 2d863e92
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/uio.h> #include <linux/uio.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/smp_lock.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -382,15 +383,19 @@ static int mbcs_open(struct inode *ip, struct file *fp) ...@@ -382,15 +383,19 @@ static int mbcs_open(struct inode *ip, struct file *fp)
struct mbcs_soft *soft; struct mbcs_soft *soft;
int minor; int minor;
lock_kernel();
minor = iminor(ip); minor = iminor(ip);
/* Nothing protects access to this list... */
list_for_each_entry(soft, &soft_list, list) { list_for_each_entry(soft, &soft_list, list) {
if (soft->nasid == minor) { if (soft->nasid == minor) {
fp->private_data = soft->cxdev; fp->private_data = soft->cxdev;
unlock_kernel();
return 0; return 0;
} }
} }
unlock_kernel();
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment