提交 72b67048 编写于 作者: J Jonathan Corbet

UBI: cdev lock_kernel() pushdown

Signed-off-by: NJonathan Corbet <corbet@lwn.net>
上级 6071239e
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/ioctl.h> #include <linux/ioctl.h>
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/smp_lock.h>
#include <mtd/ubi-user.h> #include <mtd/ubi-user.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/div64.h> #include <asm/div64.h>
...@@ -103,9 +104,12 @@ static int vol_cdev_open(struct inode *inode, struct file *file) ...@@ -103,9 +104,12 @@ static int vol_cdev_open(struct inode *inode, struct file *file)
struct ubi_volume_desc *desc; struct ubi_volume_desc *desc;
int vol_id = iminor(inode) - 1, mode, ubi_num; int vol_id = iminor(inode) - 1, mode, ubi_num;
lock_kernel();
ubi_num = ubi_major2num(imajor(inode)); ubi_num = ubi_major2num(imajor(inode));
if (ubi_num < 0) if (ubi_num < 0) {
unlock_kernel();
return ubi_num; return ubi_num;
}
if (file->f_mode & FMODE_WRITE) if (file->f_mode & FMODE_WRITE)
mode = UBI_READWRITE; mode = UBI_READWRITE;
...@@ -115,6 +119,7 @@ static int vol_cdev_open(struct inode *inode, struct file *file) ...@@ -115,6 +119,7 @@ static int vol_cdev_open(struct inode *inode, struct file *file)
dbg_msg("open volume %d, mode %d", vol_id, mode); dbg_msg("open volume %d, mode %d", vol_id, mode);
desc = ubi_open_volume(ubi_num, vol_id, mode); desc = ubi_open_volume(ubi_num, vol_id, mode);
unlock_kernel();
if (IS_ERR(desc)) if (IS_ERR(desc))
return PTR_ERR(desc); return PTR_ERR(desc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册