[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1255300742-8863-1-git-send-email-fweisbec@gmail.com>
Date: Mon, 12 Oct 2009 00:39:02 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...e.hu>, John Kacur <jkacur@...hat.com>,
Sven-Thorsten Dietrich <sven@...bigcorporation.com>,
Jonathan Corbet <corbet@....net>,
Alessio Igor Bogani <abogani@...ware.it>,
Arnd Bergmann <arnd@...db.de>,
Alan Cox <alan@...rguk.ukuu.org.uk>
Subject: [PATCH v2] generic_nvram: Turn nvram_ioctl into an unlocked ioctl
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.
v2: Fix nvram_ioctl to fit unlocked_ioctl signature.
Reported-by: Arnd Bergmann <arnd@...db.de>
Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: John Kacur <jkacur@...hat.com>
Cc: Sven-Thorsten Dietrich <sven@...bigcorporation.com>
Cc: Jonathan Corbet <corbet@....net>
Cc: Alessio Igor Bogani <abogani@...ware.it>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Alan Cox <alan@...rguk.ukuu.org.uk>
---
drivers/char/generic_nvram.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
index c49200e..866d04d 100644
--- a/drivers/char/generic_nvram.c
+++ b/drivers/char/generic_nvram.c
@@ -85,8 +85,7 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,
return p - buf;
}
-static int nvram_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+static int nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
switch(cmd) {
#ifdef CONFIG_PPC_PMAC
@@ -118,11 +117,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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists