From: Jonathan Corbet Date: Thu, 15 May 2008 17:24:23 +0000 (-0600) Subject: mbcs: cdev lock_kernel() pushdown X-Git-Tag: v2.6.27-rc1~1103^2~125 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=12ead6b098b65dd21d3ed4fcccf20025dbe86cc2;p=linux-2.6-omap-h63xx.git mbcs: cdev lock_kernel() pushdown This driver would appear to have no internal locking at all. Signed-off-by: Jonathan Corbet --- diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index f4716ad7348..acd8e9ed474 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -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; }