提交 3462032d 编写于 作者: J Jonathan Corbet

divamnt: BKL pushdown

Put explicit lock_kernel() calls into maint_open().
Signed-off-by: NJonathan Corbet <corbet@lwn.net>
上级 a237f3bb
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "platform.h" #include "platform.h"
...@@ -127,14 +128,19 @@ static unsigned int maint_poll(struct file *file, poll_table * wait) ...@@ -127,14 +128,19 @@ static unsigned int maint_poll(struct file *file, poll_table * wait)
static int maint_open(struct inode *ino, struct file *filep) static int maint_open(struct inode *ino, struct file *filep)
{ {
int ret;
lock_kernel();
/* only one open is allowed, so we test /* only one open is allowed, so we test
it atomically */ it atomically */
if (test_and_set_bit(0, &opened)) if (test_and_set_bit(0, &opened))
return (-EBUSY); ret = -EBUSY;
else {
filep->private_data = NULL; filep->private_data = NULL;
ret = nonseekable_open(ino, filep);
return nonseekable_open(ino, filep); }
unlock_kernel();
return ret;
} }
static int maint_close(struct inode *ino, struct file *filep) static int maint_close(struct inode *ino, struct file *filep)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册