aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/cdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/cdev.c')
-rw-r--r--drivers/mtd/ubi/cdev.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 9d6aae5449b6..89193ba9451e 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -39,6 +39,7 @@
39#include <linux/stat.h> 39#include <linux/stat.h>
40#include <linux/ioctl.h> 40#include <linux/ioctl.h>
41#include <linux/capability.h> 41#include <linux/capability.h>
42#include <linux/smp_lock.h>
42#include <mtd/ubi-user.h> 43#include <mtd/ubi-user.h>
43#include <asm/uaccess.h> 44#include <asm/uaccess.h>
44#include <asm/div64.h> 45#include <asm/div64.h>
@@ -103,9 +104,12 @@ static int vol_cdev_open(struct inode *inode, struct file *file)
103 struct ubi_volume_desc *desc; 104 struct ubi_volume_desc *desc;
104 int vol_id = iminor(inode) - 1, mode, ubi_num; 105 int vol_id = iminor(inode) - 1, mode, ubi_num;
105 106
107 lock_kernel();
106 ubi_num = ubi_major2num(imajor(inode)); 108 ubi_num = ubi_major2num(imajor(inode));
107 if (ubi_num < 0) 109 if (ubi_num < 0) {
110 unlock_kernel();
108 return ubi_num; 111 return ubi_num;
112 }
109 113
110 if (file->f_mode & FMODE_WRITE) 114 if (file->f_mode & FMODE_WRITE)
111 mode = UBI_READWRITE; 115 mode = UBI_READWRITE;
@@ -115,6 +119,7 @@ static int vol_cdev_open(struct inode *inode, struct file *file)
115 dbg_msg("open volume %d, mode %d", vol_id, mode); 119 dbg_msg("open volume %d, mode %d", vol_id, mode);
116 120
117 desc = ubi_open_volume(ubi_num, vol_id, mode); 121 desc = ubi_open_volume(ubi_num, vol_id, mode);
122 unlock_kernel();
118 if (IS_ERR(desc)) 123 if (IS_ERR(desc))
119 return PTR_ERR(desc); 124 return PTR_ERR(desc);
120 125