提交 28fbbf49 编写于 作者: A Arnd Bergmann 提交者: Jonathan Corbet

jsflash: BKL pushdown

Signed-off-by: NArnd Bergmann <arnd@arndb.de>
上级 cddf63d9
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/smp_lock.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
...@@ -417,11 +418,17 @@ static int jsf_mmap(struct file * file, struct vm_area_struct * vma) ...@@ -417,11 +418,17 @@ static int jsf_mmap(struct file * file, struct vm_area_struct * vma)
static int jsf_open(struct inode * inode, struct file * filp) static int jsf_open(struct inode * inode, struct file * filp)
{ {
lock_kernel();
if (jsf0.base == 0) return -ENXIO; if (jsf0.base == 0) {
if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) unlock_kernel();
return -ENXIO;
}
if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) {
unlock_kernel();
return -EBUSY; return -EBUSY;
}
unlock_kernel();
return 0; /* XXX What security? */ return 0; /* XXX What security? */
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册