Commit 309c4551 authored by Jonathan Corbet's avatar Jonathan Corbet

misc: cdev lock_kernel() pushdown

misc_open() looks fine, but who knows what all of the misc drivers are
doing in their open() functions?
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 1f439647
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/smp_lock.h>
/* /*
* Head entry for the doubly linked miscdevice list * Head entry for the doubly linked miscdevice list
...@@ -118,6 +119,7 @@ static int misc_open(struct inode * inode, struct file * file) ...@@ -118,6 +119,7 @@ static int misc_open(struct inode * inode, struct file * file)
int err = -ENODEV; int err = -ENODEV;
const struct file_operations *old_fops, *new_fops = NULL; const struct file_operations *old_fops, *new_fops = NULL;
lock_kernel();
mutex_lock(&misc_mtx); mutex_lock(&misc_mtx);
list_for_each_entry(c, &misc_list, list) { list_for_each_entry(c, &misc_list, list) {
...@@ -155,6 +157,7 @@ static int misc_open(struct inode * inode, struct file * file) ...@@ -155,6 +157,7 @@ static int misc_open(struct inode * inode, struct file * file)
fops_put(old_fops); fops_put(old_fops);
fail: fail:
mutex_unlock(&misc_mtx); mutex_unlock(&misc_mtx);
unlock_kernel();
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment