diff options
Diffstat (limited to 'drivers/char/nvram.c')
-rw-r--r-- | drivers/char/nvram.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 98dec380af49..197cd7a0c332 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c | |||
@@ -107,6 +107,7 @@ | |||
107 | #include <linux/init.h> | 107 | #include <linux/init.h> |
108 | #include <linux/proc_fs.h> | 108 | #include <linux/proc_fs.h> |
109 | #include <linux/spinlock.h> | 109 | #include <linux/spinlock.h> |
110 | #include <linux/smp_lock.h> | ||
110 | 111 | ||
111 | #include <asm/io.h> | 112 | #include <asm/io.h> |
112 | #include <asm/uaccess.h> | 113 | #include <asm/uaccess.h> |
@@ -333,12 +334,14 @@ nvram_ioctl(struct inode *inode, struct file *file, | |||
333 | static int | 334 | static int |
334 | nvram_open(struct inode *inode, struct file *file) | 335 | nvram_open(struct inode *inode, struct file *file) |
335 | { | 336 | { |
337 | lock_kernel(); | ||
336 | spin_lock(&nvram_state_lock); | 338 | spin_lock(&nvram_state_lock); |
337 | 339 | ||
338 | if ((nvram_open_cnt && (file->f_flags & O_EXCL)) || | 340 | if ((nvram_open_cnt && (file->f_flags & O_EXCL)) || |
339 | (nvram_open_mode & NVRAM_EXCL) || | 341 | (nvram_open_mode & NVRAM_EXCL) || |
340 | ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) { | 342 | ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) { |
341 | spin_unlock(&nvram_state_lock); | 343 | spin_unlock(&nvram_state_lock); |
344 | unlock_kernel(); | ||
342 | return -EBUSY; | 345 | return -EBUSY; |
343 | } | 346 | } |
344 | 347 | ||
@@ -349,6 +352,7 @@ nvram_open(struct inode *inode, struct file *file) | |||
349 | nvram_open_cnt++; | 352 | nvram_open_cnt++; |
350 | 353 | ||
351 | spin_unlock(&nvram_state_lock); | 354 | spin_unlock(&nvram_state_lock); |
355 | unlock_kernel(); | ||
352 | 356 | ||
353 | return 0; | 357 | return 0; |
354 | } | 358 | } |