Commit 6ce46a43 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jonathan Corbet

monreader: BKL pushdown

[jmc: added <linux/smp_lock.h>]
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 77149367
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp_lock.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -340,6 +341,7 @@ static int mon_open(struct inode *inode, struct file *filp) ...@@ -340,6 +341,7 @@ static int mon_open(struct inode *inode, struct file *filp)
/* /*
* only one user allowed * only one user allowed
*/ */
lock_kernel();
rc = -EBUSY; rc = -EBUSY;
if (test_and_set_bit(MON_IN_USE, &mon_in_use)) if (test_and_set_bit(MON_IN_USE, &mon_in_use))
goto out; goto out;
...@@ -377,6 +379,7 @@ static int mon_open(struct inode *inode, struct file *filp) ...@@ -377,6 +379,7 @@ static int mon_open(struct inode *inode, struct file *filp)
} }
P_INFO("open, established connection to *MONITOR service\n\n"); P_INFO("open, established connection to *MONITOR service\n\n");
filp->private_data = monpriv; filp->private_data = monpriv;
unlock_kernel();
return nonseekable_open(inode, filp); return nonseekable_open(inode, filp);
out_path: out_path:
...@@ -386,6 +389,7 @@ static int mon_open(struct inode *inode, struct file *filp) ...@@ -386,6 +389,7 @@ static int mon_open(struct inode *inode, struct file *filp)
out_use: out_use:
clear_bit(MON_IN_USE, &mon_in_use); clear_bit(MON_IN_USE, &mon_in_use);
out: out:
unlock_kernel();
return rc; return rc;
} }
......
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