Skip to content

Commit 12ead6b

Browse files
author
Jonathan Corbet
committed
mbcs: cdev lock_kernel() pushdown
This driver would appear to have no internal locking at all. Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 2d863e9 commit 12ead6b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎drivers/char/mbcs.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/mm.h>
2525
#include <linux/uio.h>
2626
#include <linux/mutex.h>
27+
#include <linux/smp_lock.h>
2728
#include <asm/io.h>
2829
#include <asm/uaccess.h>
2930
#include <asm/system.h>
@@ -382,15 +383,19 @@ static int mbcs_open(struct inode *ip, struct file *fp)
382383
struct mbcs_soft *soft;
383384
int minor;
384385

386+
lock_kernel();
385387
minor = iminor(ip);
386388

389+
/* Nothing protects access to this list... */
387390
list_for_each_entry(soft, &soft_list, list) {
388391
if (soft->nasid == minor) {
389392
fp->private_data = soft->cxdev;
393+
unlock_kernel();
390394
return 0;
391395
}
392396
}
393397

398+
unlock_kernel();
394399
return -ENODEV;
395400
}
396401

0 commit comments

Comments
 (0)