lkml.org 
[lkml]   [2009]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] generic_nvram: Turn nvram_ioctl into an unlocked ioctl
Date
nvram_ioctl is a bkl locked ioctl, but it can be an unlocked ioctl.

- part is provided by the user
- offset is provided by pmac_get_partition() which is safe as it only
touches nvram_partitions, an array inistialized on __init time and
read-only the rest of the time.
- nvram_sync() only relies on core99_nvram_sync() which checks
is_core_99, nvram_data, nvram_image. Those are variables initialized
on __init time only and their direct values are not touched further.
The rest modifies the nvram image header, protected by nv_lock
already.

So it's safe to call nvram_ioctl without the big kernel lock held.

Reported-by: Arnd Bergmann <arndbergmann@googlemail.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Kacur <jkacur@redhat.com>
Cc: Sven-Thorsten Dietrich <sven@thebigcorporation.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Alessio Igor Bogani <abogani@texware.it>
Cc: Arnd Bergmann <arndbergmann@googlemail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
---
drivers/char/generic_nvram.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
index c49200e..fd448aa 100644
--- a/drivers/char/generic_nvram.c
+++ b/drivers/char/generic_nvram.c
@@ -118,11 +118,11 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
}

const struct file_operations nvram_fops = {
- .owner = THIS_MODULE,
- .llseek = nvram_llseek,
- .read = read_nvram,
- .write = write_nvram,
- .ioctl = nvram_ioctl,
+ .owner = THIS_MODULE,
+ .llseek = nvram_llseek,
+ .read = read_nvram,
+ .write = write_nvram,
+ .unlocked_ioctl = nvram_ioctl,
};

static struct miscdevice nvram_dev = {
--
1.6.2.3


\
 
 \ /
  Last update: 2009-10-12 00:19    [W:0.134 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site