Skip to content

Commit 1f43964

Browse files
author
Jonathan Corbet
committed
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>
1 parent ecc3898 commit 1f43964

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎drivers/char/mem.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/bootmem.h>
2727
#include <linux/splice.h>
2828
#include <linux/pfn.h>
29+
#include <linux/smp_lock.h>
2930

3031
#include <asm/uaccess.h>
3132
#include <asm/io.h>
@@ -889,6 +890,9 @@ static const struct file_operations kmsg_fops = {
889890

890891
static int memory_open(struct inode * inode, struct file * filp)
891892
{
893+
int ret = 0;
894+
895+
lock_kernel();
892896
switch (iminor(inode)) {
893897
case 1:
894898
filp->f_op = &mem_fops;
@@ -932,11 +936,13 @@ static int memory_open(struct inode * inode, struct file * filp)
932936
break;
933937
#endif
934938
default:
939+
unlock_kernel();
935940
return -ENXIO;
936941
}
937942
if (filp->f_op && filp->f_op->open)
938-
return filp->f_op->open(inode,filp);
939-
return 0;
943+
ret = filp->f_op->open(inode,filp);
944+
unlock_kernel();
945+
return ret;
940946
}
941947

942948
static const struct file_operations memory_fops = {

0 commit comments

Comments
 (0)