committed by
Jonathan Corbet
parent
fd3e05b6c8
commit
930ab4e532
@@ -107,6 +107,7 @@
|
|||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
|
#include <linux/smp_lock.h>
|
||||||
|
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
@@ -333,12 +334,14 @@ nvram_ioctl(struct inode *inode, struct file *file,
|
|||||||
static int
|
static int
|
||||||
nvram_open(struct inode *inode, struct file *file)
|
nvram_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
|
lock_kernel();
|
||||||
spin_lock(&nvram_state_lock);
|
spin_lock(&nvram_state_lock);
|
||||||
|
|
||||||
if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
|
if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
|
||||||
(nvram_open_mode & NVRAM_EXCL) ||
|
(nvram_open_mode & NVRAM_EXCL) ||
|
||||||
((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) {
|
((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) {
|
||||||
spin_unlock(&nvram_state_lock);
|
spin_unlock(&nvram_state_lock);
|
||||||
|
unlock_kernel();
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,6 +352,7 @@ nvram_open(struct inode *inode, struct file *file)
|
|||||||
nvram_open_cnt++;
|
nvram_open_cnt++;
|
||||||
|
|
||||||
spin_unlock(&nvram_state_lock);
|
spin_unlock(&nvram_state_lock);
|
||||||
|
unlock_kernel();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user