Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+8 -2
+8 -2
drivers/char/mem.c
··· 26 26 #include <linux/bootmem.h> 27 27 #include <linux/splice.h> 28 28 #include <linux/pfn.h> 29 + #include <linux/smp_lock.h> 29 30 30 31 #include <asm/uaccess.h> 31 32 #include <asm/io.h> ··· 890 889 891 890 static int memory_open(struct inode * inode, struct file * filp) 892 891 { 892 + int ret = 0; 893 + 894 + lock_kernel(); 893 895 switch (iminor(inode)) { 894 896 case 1: 895 897 filp->f_op = &mem_fops; ··· 936 932 break; 937 933 #endif 938 934 default: 935 + unlock_kernel(); 939 936 return -ENXIO; 940 937 } 941 938 if (filp->f_op && filp->f_op->open) 942 - return filp->f_op->open(inode,filp); 943 - return 0; 939 + ret = filp->f_op->open(inode,filp); 940 + unlock_kernel(); 941 + return ret; 944 942 } 945 943 946 944 static const struct file_operations memory_fops = {