aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/cdev.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-15 01:44:51 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-15 01:44:51 -0400
commit43d2548bb2ef7e6d753f91468a746784041e522d (patch)
tree77d13fcd48fd998393abb825ec36e2b732684a73 /drivers/mtd/ubi/cdev.c
parent585583d95c5660973bc0cf64add517b040acd8a4 (diff)
parent85082fd7cbe3173198aac0eb5e85ab1edcc6352c (diff)
Merge commit '85082fd7cbe3173198aac0eb5e85ab1edcc6352c' into test-build
Manual fixup of: arch/powerpc/Kconfig
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