aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/nvram.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/nvram.c')
-rw-r--r--drivers/char/nvram.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 47e8f7b0e4c1..66d2917b003f 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -296,8 +296,8 @@ checksum_err:
296 return -EIO; 296 return -EIO;
297} 297}
298 298
299static int nvram_ioctl(struct inode *inode, struct file *file, 299static long nvram_ioctl(struct file *file, unsigned int cmd,
300 unsigned int cmd, unsigned long arg) 300 unsigned long arg)
301{ 301{
302 int i; 302 int i;
303 303
@@ -308,6 +308,7 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
308 if (!capable(CAP_SYS_ADMIN)) 308 if (!capable(CAP_SYS_ADMIN))
309 return -EACCES; 309 return -EACCES;
310 310
311 lock_kernel();
311 spin_lock_irq(&rtc_lock); 312 spin_lock_irq(&rtc_lock);
312 313
313 for (i = 0; i < NVRAM_BYTES; ++i) 314 for (i = 0; i < NVRAM_BYTES; ++i)
@@ -315,6 +316,7 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
315 __nvram_set_checksum(); 316 __nvram_set_checksum();
316 317
317 spin_unlock_irq(&rtc_lock); 318 spin_unlock_irq(&rtc_lock);
319 unlock_kernel();
318 return 0; 320 return 0;
319 321
320 case NVRAM_SETCKS: 322 case NVRAM_SETCKS:
@@ -323,9 +325,11 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
323 if (!capable(CAP_SYS_ADMIN)) 325 if (!capable(CAP_SYS_ADMIN))
324 return -EACCES; 326 return -EACCES;
325 327
328 lock_kernel();
326 spin_lock_irq(&rtc_lock); 329 spin_lock_irq(&rtc_lock);
327 __nvram_set_checksum(); 330 __nvram_set_checksum();
328 spin_unlock_irq(&rtc_lock); 331 spin_unlock_irq(&rtc_lock);
332 unlock_kernel();
329 return 0; 333 return 0;
330 334
331 default: 335 default:
@@ -422,7 +426,7 @@ static const struct file_operations nvram_fops = {
422 .llseek = nvram_llseek, 426 .llseek = nvram_llseek,
423 .read = nvram_read, 427 .read = nvram_read,
424 .write = nvram_write, 428 .write = nvram_write,
425 .ioctl = nvram_ioctl, 429 .unlocked_ioctl = nvram_ioctl,
426 .open = nvram_open, 430 .open = nvram_open,
427 .release = nvram_release, 431 .release = nvram_release,
428}; 432};