summaryrefslogtreecommitdiffstats
path: root/drivers/char/mem.c
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-15 19:04:19 +0200
committerJonathan Corbet <corbet@lwn.net>2008-06-20 22:05:48 +0200
commit1f439647a4072ec64bb2e4b9290cd7be6aee8328 (patch)
tree3ffcaa8ff39ea1324fe60bbc4fd35c6f77141083 /drivers/char/mem.c
parentipmi: cdev lock_kernel() pushdown (diff)
downloadlinux-1f439647a4072ec64bb2e4b9290cd7be6aee8328.tar.xz
linux-1f439647a4072ec64bb2e4b9290cd7be6aee8328.zip
mem: cdev lock_kernel() pushdown
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>
Diffstat (limited to '')
-rw-r--r--drivers/char/mem.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 934ffafedaea..070e22e8ea9e 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -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 = {