misc_open() looks fine, but who knows what all of the misc drivers are
doing in their open() functions?
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
#include <linux/device.h>
#include <linux/tty.h>
#include <linux/kmod.h>
+#include <linux/smp_lock.h>
/*
* Head entry for the doubly linked miscdevice list
int err = -ENODEV;
const struct file_operations *old_fops, *new_fops = NULL;
+ lock_kernel();
mutex_lock(&misc_mtx);
list_for_each_entry(c, &misc_list, list) {
fops_put(old_fops);
fail:
mutex_unlock(&misc_mtx);
+ unlock_kernel();
return err;
}