bpp: bkl pushdown
authorJonathan Corbet <corbet@lwn.net>
Fri, 16 May 2008 20:06:45 +0000 (14:06 -0600)
committerJonathan Corbet <corbet@lwn.net>
Fri, 20 Jun 2008 20:05:51 +0000 (14:05 -0600)
Put explicit lock_kernel() calls into bpp_open().  It has locking, but I'm
not convinced it won't race with ioctl().

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
drivers/sbus/char/bpp.c

index b87037e..c1c091a 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/timer.h>
 #include <linux/ioport.h>
 #include <linux/major.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -429,6 +430,7 @@ static int bpp_open(struct inode *inode, struct file *f)
       unsigned minor = iminor(inode);
       int ret;
 
+      lock_kernel();
       spin_lock(&bpp_open_lock);
       ret = 0;
       if (minor >= BPP_NO) {
@@ -444,6 +446,7 @@ static int bpp_open(struct inode *inode, struct file *f)
              }
       }
       spin_unlock(&bpp_open_lock);
+      unlock_kernel();
 
       return ret;
 }