]> err.no Git - linux-2.6/commitdiff
mem: cdev lock_kernel() pushdown
authorJonathan Corbet <corbet@lwn.net>
Thu, 15 May 2008 17:04:19 +0000 (11:04 -0600)
committerJonathan Corbet <corbet@lwn.net>
Fri, 20 Jun 2008 20:05:48 +0000 (14:05 -0600)
It's really hard to tell if this is necessary - lots of weird
magic happens by way of map_devmem()

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

index 934ffafedaea207131f7d193bed9e75c929f4db9..070e22e8ea9efb43a180149caa5a47d70faf471f 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/bootmem.h>
 #include <linux/splice.h>
 #include <linux/pfn.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -889,6 +890,9 @@ static const struct file_operations kmsg_fops = {
 
 static int memory_open(struct inode * inode, struct file * filp)
 {
+       int ret = 0;
+
+       lock_kernel();
        switch (iminor(inode)) {
                case 1:
                        filp->f_op = &mem_fops;
@@ -932,11 +936,13 @@ static int memory_open(struct inode * inode, struct file * filp)
                        break;
 #endif
                default:
+                       unlock_kernel();
                        return -ENXIO;
        }
        if (filp->f_op && filp->f_op->open)
-               return filp->f_op->open(inode,filp);
-       return 0;
+               ret = filp->f_op->open(inode,filp);
+       unlock_kernel();
+       return ret;
 }
 
 static const struct file_operations memory_fops = {