aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c9
-rw-r--r--arch/um/drivers/harddog_kern.c18
-rw-r--r--arch/um/drivers/hostaudio_kern.c8
-rw-r--r--arch/um/drivers/mmapper_kern.c5
-rw-r--r--drivers/char/apm-emulation.c8
-rw-r--r--drivers/char/applicom.c13
-rw-r--r--drivers/char/ds1620.c16
-rw-r--r--drivers/char/dtlk.c15
-rw-r--r--drivers/char/generic_nvram.c17
-rw-r--r--drivers/char/genrtc.c16
-rw-r--r--drivers/char/hpet.c14
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c26
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c17
-rw-r--r--drivers/char/nvram.c10
-rw-r--r--drivers/char/nwflash.c7
-rw-r--r--drivers/char/raw.c42
-rw-r--r--drivers/hwmon/fschmd.c9
-rw-r--r--drivers/hwmon/w83793.c10
-rw-r--r--drivers/input/misc/hp_sdc_rtc.c34
-rw-r--r--drivers/isdn/capi/capi.c17
-rw-r--r--drivers/isdn/i4l/isdn_common.c18
-rw-r--r--drivers/isdn/mISDN/timerdev.c10
-rw-r--r--drivers/macintosh/nvram.c2
-rw-r--r--drivers/macintosh/via-pmu.c17
-rw-r--r--drivers/media/dvb/dvb-core/dmxdev.c31
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ca_en50221.c17
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c30
-rw-r--r--drivers/media/dvb/dvb-core/dvb_net.c15
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c17
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.h11
-rw-r--r--drivers/media/dvb/firewire/firedtv-ci.c5
-rw-r--r--drivers/media/dvb/ttpci/av7110.c4
-rw-r--r--drivers/media/dvb/ttpci/av7110_av.c8
-rw-r--r--drivers/media/dvb/ttpci/av7110_ca.c5
-rw-r--r--drivers/mtd/mtdchar.c19
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c17
-rw-r--r--drivers/rtc/rtc-m41t80.c16
-rw-r--r--drivers/sbus/char/openprom.c44
-rw-r--r--drivers/scsi/3w-9xxx.c10
-rw-r--r--drivers/scsi/3w-sas.c8
-rw-r--r--drivers/scsi/3w-xxxx.c11
-rw-r--r--drivers/scsi/aacraid/linit.c11
-rw-r--r--drivers/scsi/dpt_i2o.c20
-rw-r--r--drivers/scsi/gdth.c20
-rw-r--r--drivers/scsi/megaraid.c20
-rw-r--r--drivers/scsi/megaraid.h3
-rw-r--r--drivers/scsi/megaraid/megaraid_mm.c22
-rw-r--r--drivers/scsi/osst.c14
-rw-r--r--drivers/scsi/sg.c17
-rw-r--r--drivers/usb/mon/mon_bin.c23
-rw-r--r--drivers/usb/mon/mon_stat.c3
-rw-r--r--fs/autofs4/root.c22
-rw-r--r--fs/coda/pioctl.c76
-rw-r--r--fs/coda/psdev.c5
-rw-r--r--fs/hfsplus/dir.c2
-rw-r--r--fs/hfsplus/hfsplus_fs.h3
-rw-r--r--fs/hfsplus/inode.c2
-rw-r--r--fs/hfsplus/ioctl.c12
-rw-r--r--fs/ncpfs/dir.c2
-rw-r--r--fs/ncpfs/file.c2
-rw-r--r--fs/ncpfs/ioctl.c27
-rw-r--r--fs/smbfs/dir.c2
-rw-r--r--fs/smbfs/file.c2
-rw-r--r--fs/smbfs/ioctl.c10
-rw-r--r--fs/smbfs/proto.h2
-rw-r--r--include/linux/ncp_fs.h2
-rw-r--r--net/sunrpc/cache.c13
-rw-r--r--net/sunrpc/rpc_pipe.c18
68 files changed, 669 insertions, 312 deletions
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index f6c1c5fd075d..fa1eceed0d23 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -30,7 +30,6 @@
30#include <linux/miscdevice.h> 30#include <linux/miscdevice.h>
31#include <linux/utsname.h> 31#include <linux/utsname.h>
32#include <linux/cpumask.h> 32#include <linux/cpumask.h>
33#include <linux/smp_lock.h>
34#include <linux/nodemask.h> 33#include <linux/nodemask.h>
35#include <linux/smp.h> 34#include <linux/smp.h>
36#include <linux/mutex.h> 35#include <linux/mutex.h>
@@ -682,8 +681,7 @@ static int sn_hwperf_map_err(int hwperf_err)
682/* 681/*
683 * ioctl for "sn_hwperf" misc device 682 * ioctl for "sn_hwperf" misc device
684 */ 683 */
685static int 684static long sn_hwperf_ioctl(struct file *fp, u32 op, unsigned long arg)
686sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
687{ 685{
688 struct sn_hwperf_ioctl_args a; 686 struct sn_hwperf_ioctl_args a;
689 struct cpuinfo_ia64 *cdata; 687 struct cpuinfo_ia64 *cdata;
@@ -699,8 +697,6 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
699 int i; 697 int i;
700 int j; 698 int j;
701 699
702 unlock_kernel();
703
704 /* only user requests are allowed here */ 700 /* only user requests are allowed here */
705 if ((op & SN_HWPERF_OP_MASK) < 10) { 701 if ((op & SN_HWPERF_OP_MASK) < 10) {
706 r = -EINVAL; 702 r = -EINVAL;
@@ -859,12 +855,11 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
859error: 855error:
860 vfree(p); 856 vfree(p);
861 857
862 lock_kernel();
863 return r; 858 return r;
864} 859}
865 860
866static const struct file_operations sn_hwperf_fops = { 861static const struct file_operations sn_hwperf_fops = {
867 .ioctl = sn_hwperf_ioctl, 862 .unlocked_ioctl = sn_hwperf_ioctl,
868}; 863};
869 864
870static struct miscdevice sn_hwperf_dev = { 865static struct miscdevice sn_hwperf_dev = {
diff --git a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c
index d332503fa1be..cfcac1ff4cf2 100644
--- a/arch/um/drivers/harddog_kern.c
+++ b/arch/um/drivers/harddog_kern.c
@@ -124,8 +124,8 @@ static ssize_t harddog_write(struct file *file, const char __user *data, size_t
124 return 0; 124 return 0;
125} 125}
126 126
127static int harddog_ioctl(struct inode *inode, struct file *file, 127static int harddog_ioctl_unlocked(struct file *file,
128 unsigned int cmd, unsigned long arg) 128 unsigned int cmd, unsigned long arg)
129{ 129{
130 void __user *argp= (void __user *)arg; 130 void __user *argp= (void __user *)arg;
131 static struct watchdog_info ident = { 131 static struct watchdog_info ident = {
@@ -148,10 +148,22 @@ static int harddog_ioctl(struct inode *inode, struct file *file,
148 } 148 }
149} 149}
150 150
151static long harddog_ioctl(struct file *file,
152 unsigned int cmd, unsigned long arg)
153{
154 long ret;
155
156 lock_kernel();
157 ret = harddog_ioctl_unlocked(file, cmd, arg);
158 unlock_kernel();
159
160 return ret;
161}
162
151static const struct file_operations harddog_fops = { 163static const struct file_operations harddog_fops = {
152 .owner = THIS_MODULE, 164 .owner = THIS_MODULE,
153 .write = harddog_write, 165 .write = harddog_write,
154 .ioctl = harddog_ioctl, 166 .unlocked_ioctl = harddog_ioctl,
155 .open = harddog_open, 167 .open = harddog_open,
156 .release = harddog_release, 168 .release = harddog_release,
157}; 169};
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index 368219cc2366..ae42695c3597 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -136,7 +136,7 @@ static unsigned int hostaudio_poll(struct file *file,
136 return mask; 136 return mask;
137} 137}
138 138
139static int hostaudio_ioctl(struct inode *inode, struct file *file, 139static long hostaudio_ioctl(struct file *file,
140 unsigned int cmd, unsigned long arg) 140 unsigned int cmd, unsigned long arg)
141{ 141{
142 struct hostaudio_state *state = file->private_data; 142 struct hostaudio_state *state = file->private_data;
@@ -223,7 +223,7 @@ static int hostaudio_release(struct inode *inode, struct file *file)
223 223
224/* /dev/mixer file operations */ 224/* /dev/mixer file operations */
225 225
226static int hostmixer_ioctl_mixdev(struct inode *inode, struct file *file, 226static long hostmixer_ioctl_mixdev(struct file *file,
227 unsigned int cmd, unsigned long arg) 227 unsigned int cmd, unsigned long arg)
228{ 228{
229 struct hostmixer_state *state = file->private_data; 229 struct hostmixer_state *state = file->private_data;
@@ -289,7 +289,7 @@ static const struct file_operations hostaudio_fops = {
289 .read = hostaudio_read, 289 .read = hostaudio_read,
290 .write = hostaudio_write, 290 .write = hostaudio_write,
291 .poll = hostaudio_poll, 291 .poll = hostaudio_poll,
292 .ioctl = hostaudio_ioctl, 292 .unlocked_ioctl = hostaudio_ioctl,
293 .mmap = NULL, 293 .mmap = NULL,
294 .open = hostaudio_open, 294 .open = hostaudio_open,
295 .release = hostaudio_release, 295 .release = hostaudio_release,
@@ -298,7 +298,7 @@ static const struct file_operations hostaudio_fops = {
298static const struct file_operations hostmixer_fops = { 298static const struct file_operations hostmixer_fops = {
299 .owner = THIS_MODULE, 299 .owner = THIS_MODULE,
300 .llseek = no_llseek, 300 .llseek = no_llseek,
301 .ioctl = hostmixer_ioctl_mixdev, 301 .unlocked_ioctl = hostmixer_ioctl_mixdev,
302 .open = hostmixer_open_mixdev, 302 .open = hostmixer_open_mixdev,
303 .release = hostmixer_release, 303 .release = hostmixer_release,
304}; 304};
diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c
index d22f9e5c0eac..7158393b6793 100644
--- a/arch/um/drivers/mmapper_kern.c
+++ b/arch/um/drivers/mmapper_kern.c
@@ -46,8 +46,7 @@ static ssize_t mmapper_write(struct file *file, const char __user *buf,
46 return count; 46 return count;
47} 47}
48 48
49static int mmapper_ioctl(struct inode *inode, struct file *file, 49static long mmapper_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
50 unsigned int cmd, unsigned long arg)
51{ 50{
52 return -ENOIOCTLCMD; 51 return -ENOIOCTLCMD;
53} 52}
@@ -90,7 +89,7 @@ static const struct file_operations mmapper_fops = {
90 .owner = THIS_MODULE, 89 .owner = THIS_MODULE,
91 .read = mmapper_read, 90 .read = mmapper_read,
92 .write = mmapper_write, 91 .write = mmapper_write,
93 .ioctl = mmapper_ioctl, 92 .unlocked_ioctl = mmapper_ioctl,
94 .mmap = mmapper_mmap, 93 .mmap = mmapper_mmap,
95 .open = mmapper_open, 94 .open = mmapper_open,
96 .release = mmapper_release, 95 .release = mmapper_release,
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c
index 4f568cb9af3f..033e1505fca9 100644
--- a/drivers/char/apm-emulation.c
+++ b/drivers/char/apm-emulation.c
@@ -265,8 +265,8 @@ static unsigned int apm_poll(struct file *fp, poll_table * wait)
265 * Only when everyone who has opened /dev/apm_bios with write permission 265 * Only when everyone who has opened /dev/apm_bios with write permission
266 * has acknowledge does the actual suspend happen. 266 * has acknowledge does the actual suspend happen.
267 */ 267 */
268static int 268static long
269apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) 269apm_ioctl(struct file *filp, u_int cmd, u_long arg)
270{ 270{
271 struct apm_user *as = filp->private_data; 271 struct apm_user *as = filp->private_data;
272 int err = -EINVAL; 272 int err = -EINVAL;
@@ -274,6 +274,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
274 if (!as->suser || !as->writer) 274 if (!as->suser || !as->writer)
275 return -EPERM; 275 return -EPERM;
276 276
277 lock_kernel();
277 switch (cmd) { 278 switch (cmd) {
278 case APM_IOC_SUSPEND: 279 case APM_IOC_SUSPEND:
279 mutex_lock(&state_lock); 280 mutex_lock(&state_lock);
@@ -334,6 +335,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
334 mutex_unlock(&state_lock); 335 mutex_unlock(&state_lock);
335 break; 336 break;
336 } 337 }
338 unlock_kernel();
337 339
338 return err; 340 return err;
339} 341}
@@ -397,7 +399,7 @@ static const struct file_operations apm_bios_fops = {
397 .owner = THIS_MODULE, 399 .owner = THIS_MODULE,
398 .read = apm_read, 400 .read = apm_read,
399 .poll = apm_poll, 401 .poll = apm_poll,
400 .ioctl = apm_ioctl, 402 .unlocked_ioctl = apm_ioctl,
401 .open = apm_open, 403 .open = apm_open,
402 .release = apm_release, 404 .release = apm_release,
403}; 405};
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index a7424bf7eacf..63313a33ba5f 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -26,6 +26,7 @@
26#include <linux/sched.h> 26#include <linux/sched.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/smp_lock.h>
29#include <linux/miscdevice.h> 30#include <linux/miscdevice.h>
30#include <linux/pci.h> 31#include <linux/pci.h>
31#include <linux/wait.h> 32#include <linux/wait.h>
@@ -106,8 +107,7 @@ static unsigned int DeviceErrorCount; /* number of device error */
106 107
107static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *); 108static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *);
108static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *); 109static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *);
109static int ac_ioctl(struct inode *, struct file *, unsigned int, 110static long ac_ioctl(struct file *, unsigned int, unsigned long);
110 unsigned long);
111static irqreturn_t ac_interrupt(int, void *); 111static irqreturn_t ac_interrupt(int, void *);
112 112
113static const struct file_operations ac_fops = { 113static const struct file_operations ac_fops = {
@@ -115,7 +115,7 @@ static const struct file_operations ac_fops = {
115 .llseek = no_llseek, 115 .llseek = no_llseek,
116 .read = ac_read, 116 .read = ac_read,
117 .write = ac_write, 117 .write = ac_write,
118 .ioctl = ac_ioctl, 118 .unlocked_ioctl = ac_ioctl,
119}; 119};
120 120
121static struct miscdevice ac_miscdev = { 121static struct miscdevice ac_miscdev = {
@@ -689,7 +689,7 @@ static irqreturn_t ac_interrupt(int vec, void *dev_instance)
689 689
690 690
691 691
692static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 692static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
693 693
694{ /* @ ADG ou ATO selon le cas */ 694{ /* @ ADG ou ATO selon le cas */
695 int i; 695 int i;
@@ -711,7 +711,8 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
711 kfree(adgl); 711 kfree(adgl);
712 return -EFAULT; 712 return -EFAULT;
713 } 713 }
714 714
715 lock_kernel();
715 IndexCard = adgl->num_card-1; 716 IndexCard = adgl->num_card-1;
716 717
717 if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) { 718 if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
@@ -721,6 +722,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
721 warncount--; 722 warncount--;
722 } 723 }
723 kfree(adgl); 724 kfree(adgl);
725 unlock_kernel();
724 return -EINVAL; 726 return -EINVAL;
725 } 727 }
726 728
@@ -838,6 +840,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
838 } 840 }
839 Dummy = readb(apbs[IndexCard].RamIO + VERS); 841 Dummy = readb(apbs[IndexCard].RamIO + VERS);
840 kfree(adgl); 842 kfree(adgl);
843 unlock_kernel();
841 return 0; 844 return 0;
842} 845}
843 846
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c
index 61f0146e215d..dbee8688f75c 100644
--- a/drivers/char/ds1620.c
+++ b/drivers/char/ds1620.c
@@ -232,7 +232,7 @@ ds1620_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
232} 232}
233 233
234static int 234static int
235ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 235ds1620_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
236{ 236{
237 struct therm therm; 237 struct therm therm;
238 union { 238 union {
@@ -316,6 +316,18 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
316 return 0; 316 return 0;
317} 317}
318 318
319static long
320ds1620_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
321{
322 int ret;
323
324 lock_kernel();
325 ret = ds1620_ioctl(file, cmd, arg);
326 unlock_kernel();
327
328 return ret;
329}
330
319#ifdef THERM_USE_PROC 331#ifdef THERM_USE_PROC
320static int 332static int
321proc_therm_ds1620_read(char *buf, char **start, off_t offset, 333proc_therm_ds1620_read(char *buf, char **start, off_t offset,
@@ -344,7 +356,7 @@ static const struct file_operations ds1620_fops = {
344 .owner = THIS_MODULE, 356 .owner = THIS_MODULE,
345 .open = ds1620_open, 357 .open = ds1620_open,
346 .read = ds1620_read, 358 .read = ds1620_read,
347 .ioctl = ds1620_ioctl, 359 .unlocked_ioctl = ds1620_unlocked_ioctl,
348}; 360};
349 361
350static struct miscdevice ds1620_miscdev = { 362static struct miscdevice ds1620_miscdev = {
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
index 045c930e6320..e3859d4eaead 100644
--- a/drivers/char/dtlk.c
+++ b/drivers/char/dtlk.c
@@ -93,8 +93,8 @@ static ssize_t dtlk_write(struct file *, const char __user *,
93static unsigned int dtlk_poll(struct file *, poll_table *); 93static unsigned int dtlk_poll(struct file *, poll_table *);
94static int dtlk_open(struct inode *, struct file *); 94static int dtlk_open(struct inode *, struct file *);
95static int dtlk_release(struct inode *, struct file *); 95static int dtlk_release(struct inode *, struct file *);
96static int dtlk_ioctl(struct inode *inode, struct file *file, 96static long dtlk_ioctl(struct file *file,
97 unsigned int cmd, unsigned long arg); 97 unsigned int cmd, unsigned long arg);
98 98
99static const struct file_operations dtlk_fops = 99static const struct file_operations dtlk_fops =
100{ 100{
@@ -102,7 +102,7 @@ static const struct file_operations dtlk_fops =
102 .read = dtlk_read, 102 .read = dtlk_read,
103 .write = dtlk_write, 103 .write = dtlk_write,
104 .poll = dtlk_poll, 104 .poll = dtlk_poll,
105 .ioctl = dtlk_ioctl, 105 .unlocked_ioctl = dtlk_ioctl,
106 .open = dtlk_open, 106 .open = dtlk_open,
107 .release = dtlk_release, 107 .release = dtlk_release,
108}; 108};
@@ -263,10 +263,9 @@ static void dtlk_timer_tick(unsigned long data)
263 wake_up_interruptible(&dtlk_process_list); 263 wake_up_interruptible(&dtlk_process_list);
264} 264}
265 265
266static int dtlk_ioctl(struct inode *inode, 266static long dtlk_ioctl(struct file *file,
267 struct file *file, 267 unsigned int cmd,
268 unsigned int cmd, 268 unsigned long arg)
269 unsigned long arg)
270{ 269{
271 char __user *argp = (char __user *)arg; 270 char __user *argp = (char __user *)arg;
272 struct dtlk_settings *sp; 271 struct dtlk_settings *sp;
@@ -276,7 +275,9 @@ static int dtlk_ioctl(struct inode *inode,
276 switch (cmd) { 275 switch (cmd) {
277 276
278 case DTLK_INTERROGATE: 277 case DTLK_INTERROGATE:
278 lock_kernel();
279 sp = dtlk_interrogate(); 279 sp = dtlk_interrogate();
280 unlock_kernel();
280 if (copy_to_user(argp, sp, sizeof(struct dtlk_settings))) 281 if (copy_to_user(argp, sp, sizeof(struct dtlk_settings)))
281 return -EINVAL; 282 return -EINVAL;
282 return 0; 283 return 0;
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
index fda4181b5e67..82b5a88a82d7 100644
--- a/drivers/char/generic_nvram.c
+++ b/drivers/char/generic_nvram.c
@@ -19,6 +19,7 @@
19#include <linux/miscdevice.h> 19#include <linux/miscdevice.h>
20#include <linux/fcntl.h> 20#include <linux/fcntl.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/smp_lock.h>
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23#include <asm/nvram.h> 24#include <asm/nvram.h>
24#ifdef CONFIG_PPC_PMAC 25#ifdef CONFIG_PPC_PMAC
@@ -84,8 +85,7 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,
84 return p - buf; 85 return p - buf;
85} 86}
86 87
87static int nvram_ioctl(struct inode *inode, struct file *file, 88static int nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
88 unsigned int cmd, unsigned long arg)
89{ 89{
90 switch(cmd) { 90 switch(cmd) {
91#ifdef CONFIG_PPC_PMAC 91#ifdef CONFIG_PPC_PMAC
@@ -116,12 +116,23 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
116 return 0; 116 return 0;
117} 117}
118 118
119static long nvram_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
120{
121 int ret;
122
123 lock_kernel();
124 ret = nvram_ioctl(file, cmd, arg);
125 unlock_kernel();
126
127 return ret;
128}
129
119const struct file_operations nvram_fops = { 130const struct file_operations nvram_fops = {
120 .owner = THIS_MODULE, 131 .owner = THIS_MODULE,
121 .llseek = nvram_llseek, 132 .llseek = nvram_llseek,
122 .read = read_nvram, 133 .read = read_nvram,
123 .write = write_nvram, 134 .write = write_nvram,
124 .ioctl = nvram_ioctl, 135 .unlocked_ioctl = nvram_unlocked_ioctl,
125}; 136};
126 137
127static struct miscdevice nvram_dev = { 138static struct miscdevice nvram_dev = {
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index 31e7c91c2d9d..b6c2cc167c11 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -262,7 +262,7 @@ static inline int gen_set_rtc_irq_bit(unsigned char bit)
262#endif 262#endif
263} 263}
264 264
265static int gen_rtc_ioctl(struct inode *inode, struct file *file, 265static int gen_rtc_ioctl(struct file *file,
266 unsigned int cmd, unsigned long arg) 266 unsigned int cmd, unsigned long arg)
267{ 267{
268 struct rtc_time wtime; 268 struct rtc_time wtime;
@@ -332,6 +332,18 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file,
332 return -EINVAL; 332 return -EINVAL;
333} 333}
334 334
335static long gen_rtc_unlocked_ioctl(struct file *file, unsigned int cmd,
336 unsigned long arg)
337{
338 int ret;
339
340 lock_kernel();
341 ret = gen_rtc_ioctl(file, cmd, arg);
342 unlock_kernel();
343
344 return ret;
345}
346
335/* 347/*
336 * We enforce only one user at a time here with the open/close. 348 * We enforce only one user at a time here with the open/close.
337 * Also clear the previous interrupt data on an open, and clean 349 * Also clear the previous interrupt data on an open, and clean
@@ -482,7 +494,7 @@ static const struct file_operations gen_rtc_fops = {
482 .read = gen_rtc_read, 494 .read = gen_rtc_read,
483 .poll = gen_rtc_poll, 495 .poll = gen_rtc_poll,
484#endif 496#endif
485 .ioctl = gen_rtc_ioctl, 497 .unlocked_ioctl = gen_rtc_unlocked_ioctl,
486 .open = gen_rtc_open, 498 .open = gen_rtc_open,
487 .release = gen_rtc_release, 499 .release = gen_rtc_release,
488}; 500};
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 9ded667625ac..a0a1829d3198 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -431,14 +431,18 @@ static int hpet_release(struct inode *inode, struct file *file)
431 431
432static int hpet_ioctl_common(struct hpet_dev *, int, unsigned long, int); 432static int hpet_ioctl_common(struct hpet_dev *, int, unsigned long, int);
433 433
434static int 434static long hpet_ioctl(struct file *file, unsigned int cmd,
435hpet_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 435 unsigned long arg)
436 unsigned long arg)
437{ 436{
438 struct hpet_dev *devp; 437 struct hpet_dev *devp;
438 int ret;
439 439
440 devp = file->private_data; 440 devp = file->private_data;
441 return hpet_ioctl_common(devp, cmd, arg, 0); 441 lock_kernel();
442 ret = hpet_ioctl_common(devp, cmd, arg, 0);
443 unlock_kernel();
444
445 return ret;
442} 446}
443 447
444static int hpet_ioctl_ieon(struct hpet_dev *devp) 448static int hpet_ioctl_ieon(struct hpet_dev *devp)
@@ -654,7 +658,7 @@ static const struct file_operations hpet_fops = {
654 .llseek = no_llseek, 658 .llseek = no_llseek,
655 .read = hpet_read, 659 .read = hpet_read,
656 .poll = hpet_poll, 660 .poll = hpet_poll,
657 .ioctl = hpet_ioctl, 661 .unlocked_ioctl = hpet_ioctl,
658 .open = hpet_open, 662 .open = hpet_open,
659 .release = hpet_release, 663 .release = hpet_release,
660 .fasync = hpet_fasync, 664 .fasync = hpet_fasync,
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index 65545de3dbf4..d8ec92a38980 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -228,8 +228,7 @@ static int handle_send_req(ipmi_user_t user,
228 return rv; 228 return rv;
229} 229}
230 230
231static int ipmi_ioctl(struct inode *inode, 231static int ipmi_ioctl(struct file *file,
232 struct file *file,
233 unsigned int cmd, 232 unsigned int cmd,
234 unsigned long data) 233 unsigned long data)
235{ 234{
@@ -630,6 +629,23 @@ static int ipmi_ioctl(struct inode *inode,
630 return rv; 629 return rv;
631} 630}
632 631
632/*
633 * Note: it doesn't make sense to take the BKL here but
634 * not in compat_ipmi_ioctl. -arnd
635 */
636static long ipmi_unlocked_ioctl(struct file *file,
637 unsigned int cmd,
638 unsigned long data)
639{
640 int ret;
641
642 lock_kernel();
643 ret = ipmi_ioctl(file, cmd, data);
644 unlock_kernel();
645
646 return ret;
647}
648
633#ifdef CONFIG_COMPAT 649#ifdef CONFIG_COMPAT
634 650
635/* 651/*
@@ -802,7 +818,7 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
802 if (copy_to_user(precv64, &recv64, sizeof(recv64))) 818 if (copy_to_user(precv64, &recv64, sizeof(recv64)))
803 return -EFAULT; 819 return -EFAULT;
804 820
805 rc = ipmi_ioctl(filep->f_path.dentry->d_inode, filep, 821 rc = ipmi_ioctl(filep,
806 ((cmd == COMPAT_IPMICTL_RECEIVE_MSG) 822 ((cmd == COMPAT_IPMICTL_RECEIVE_MSG)
807 ? IPMICTL_RECEIVE_MSG 823 ? IPMICTL_RECEIVE_MSG
808 : IPMICTL_RECEIVE_MSG_TRUNC), 824 : IPMICTL_RECEIVE_MSG_TRUNC),
@@ -819,14 +835,14 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
819 return rc; 835 return rc;
820 } 836 }
821 default: 837 default:
822 return ipmi_ioctl(filep->f_path.dentry->d_inode, filep, cmd, arg); 838 return ipmi_ioctl(filep, cmd, arg);
823 } 839 }
824} 840}
825#endif 841#endif
826 842
827static const struct file_operations ipmi_fops = { 843static const struct file_operations ipmi_fops = {
828 .owner = THIS_MODULE, 844 .owner = THIS_MODULE,
829 .ioctl = ipmi_ioctl, 845 .unlocked_ioctl = ipmi_unlocked_ioctl,
830#ifdef CONFIG_COMPAT 846#ifdef CONFIG_COMPAT
831 .compat_ioctl = compat_ipmi_ioctl, 847 .compat_ioctl = compat_ipmi_ioctl,
832#endif 848#endif
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index a4d57e31f713..82bcdb262a3a 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -659,7 +659,7 @@ static struct watchdog_info ident = {
659 .identity = "IPMI" 659 .identity = "IPMI"
660}; 660};
661 661
662static int ipmi_ioctl(struct inode *inode, struct file *file, 662static int ipmi_ioctl(struct file *file,
663 unsigned int cmd, unsigned long arg) 663 unsigned int cmd, unsigned long arg)
664{ 664{
665 void __user *argp = (void __user *)arg; 665 void __user *argp = (void __user *)arg;
@@ -730,6 +730,19 @@ static int ipmi_ioctl(struct inode *inode, struct file *file,
730 } 730 }
731} 731}
732 732
733static long ipmi_unlocked_ioctl(struct file *file,
734 unsigned int cmd,
735 unsigned long arg)
736{
737 int ret;
738
739 lock_kernel();
740 ret = ipmi_ioctl(file, cmd, arg);
741 unlock_kernel();
742
743 return ret;
744}
745
733static ssize_t ipmi_write(struct file *file, 746static ssize_t ipmi_write(struct file *file,
734 const char __user *buf, 747 const char __user *buf,
735 size_t len, 748 size_t len,
@@ -880,7 +893,7 @@ static const struct file_operations ipmi_wdog_fops = {
880 .read = ipmi_read, 893 .read = ipmi_read,
881 .poll = ipmi_poll, 894 .poll = ipmi_poll,
882 .write = ipmi_write, 895 .write = ipmi_write,
883 .ioctl = ipmi_ioctl, 896 .unlocked_ioctl = ipmi_unlocked_ioctl,
884 .open = ipmi_open, 897 .open = ipmi_open,
885 .release = ipmi_close, 898 .release = ipmi_close,
886 .fasync = ipmi_fasync, 899 .fasync = ipmi_fasync,
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};
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c
index f80810901db6..043a1c7b86be 100644
--- a/drivers/char/nwflash.c
+++ b/drivers/char/nwflash.c
@@ -94,8 +94,9 @@ static int get_flash_id(void)
94 return c2; 94 return c2;
95} 95}
96 96
97static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cmd, unsigned long arg) 97static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
98{ 98{
99 lock_kernel();
99 switch (cmd) { 100 switch (cmd) {
100 case CMD_WRITE_DISABLE: 101 case CMD_WRITE_DISABLE:
101 gbWriteBase64Enable = 0; 102 gbWriteBase64Enable = 0;
@@ -113,8 +114,10 @@ static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cm
113 default: 114 default:
114 gbWriteBase64Enable = 0; 115 gbWriteBase64Enable = 0;
115 gbWriteEnable = 0; 116 gbWriteEnable = 0;
117 unlock_kernel();
116 return -EINVAL; 118 return -EINVAL;
117 } 119 }
120 unlock_kernel();
118 return 0; 121 return 0;
119} 122}
120 123
@@ -631,7 +634,7 @@ static const struct file_operations flash_fops =
631 .llseek = flash_llseek, 634 .llseek = flash_llseek,
632 .read = flash_read, 635 .read = flash_read,
633 .write = flash_write, 636 .write = flash_write,
634 .ioctl = flash_ioctl, 637 .unlocked_ioctl = flash_ioctl,
635}; 638};
636 639
637static struct miscdevice flash_miscdev = 640static struct miscdevice flash_miscdev =
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index 8756ab0daa8b..b38942f6bf31 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -121,13 +121,17 @@ static int raw_release(struct inode *inode, struct file *filp)
121/* 121/*
122 * Forward ioctls to the underlying block device. 122 * Forward ioctls to the underlying block device.
123 */ 123 */
124static int 124static long
125raw_ioctl(struct inode *inode, struct file *filp, 125raw_ioctl(struct file *filp, unsigned int command, unsigned long arg)
126 unsigned int command, unsigned long arg)
127{ 126{
128 struct block_device *bdev = filp->private_data; 127 struct block_device *bdev = filp->private_data;
128 int ret;
129
130 lock_kernel();
131 ret = blkdev_ioctl(bdev, 0, command, arg);
132 unlock_kernel();
129 133
130 return blkdev_ioctl(bdev, 0, command, arg); 134 return ret;
131} 135}
132 136
133static void bind_device(struct raw_config_request *rq) 137static void bind_device(struct raw_config_request *rq)
@@ -141,13 +145,14 @@ static void bind_device(struct raw_config_request *rq)
141 * Deal with ioctls against the raw-device control interface, to bind 145 * Deal with ioctls against the raw-device control interface, to bind
142 * and unbind other raw devices. 146 * and unbind other raw devices.
143 */ 147 */
144static int raw_ctl_ioctl(struct inode *inode, struct file *filp, 148static long raw_ctl_ioctl(struct file *filp, unsigned int command,
145 unsigned int command, unsigned long arg) 149 unsigned long arg)
146{ 150{
147 struct raw_config_request rq; 151 struct raw_config_request rq;
148 struct raw_device_data *rawdev; 152 struct raw_device_data *rawdev;
149 int err = 0; 153 int err = 0;
150 154
155 lock_kernel();
151 switch (command) { 156 switch (command) {
152 case RAW_SETBIND: 157 case RAW_SETBIND:
153 case RAW_GETBIND: 158 case RAW_GETBIND:
@@ -240,25 +245,26 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp,
240 break; 245 break;
241 } 246 }
242out: 247out:
248 unlock_kernel();
243 return err; 249 return err;
244} 250}
245 251
246static const struct file_operations raw_fops = { 252static const struct file_operations raw_fops = {
247 .read = do_sync_read, 253 .read = do_sync_read,
248 .aio_read = generic_file_aio_read, 254 .aio_read = generic_file_aio_read,
249 .write = do_sync_write, 255 .write = do_sync_write,
250 .aio_write = blkdev_aio_write, 256 .aio_write = blkdev_aio_write,
251 .fsync = blkdev_fsync, 257 .fsync = blkdev_fsync,
252 .open = raw_open, 258 .open = raw_open,
253 .release= raw_release, 259 .release = raw_release,
254 .ioctl = raw_ioctl, 260 .unlocked_ioctl = raw_ioctl,
255 .owner = THIS_MODULE, 261 .owner = THIS_MODULE,
256}; 262};
257 263
258static const struct file_operations raw_ctl_fops = { 264static const struct file_operations raw_ctl_fops = {
259 .ioctl = raw_ctl_ioctl, 265 .unlocked_ioctl = raw_ctl_ioctl,
260 .open = raw_open, 266 .open = raw_open,
261 .owner = THIS_MODULE, 267 .owner = THIS_MODULE,
262}; 268};
263 269
264static struct cdev raw_cdev; 270static struct cdev raw_cdev;
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
index 0627f7a5b9b8..b7ca2a9676cf 100644
--- a/drivers/hwmon/fschmd.c
+++ b/drivers/hwmon/fschmd.c
@@ -38,6 +38,7 @@
38#include <linux/i2c.h> 38#include <linux/i2c.h>
39#include <linux/hwmon.h> 39#include <linux/hwmon.h>
40#include <linux/hwmon-sysfs.h> 40#include <linux/hwmon-sysfs.h>
41#include <linux/smp_lock.h>
41#include <linux/err.h> 42#include <linux/err.h>
42#include <linux/mutex.h> 43#include <linux/mutex.h>
43#include <linux/sysfs.h> 44#include <linux/sysfs.h>
@@ -847,8 +848,7 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf,
847 return count; 848 return count;
848} 849}
849 850
850static int watchdog_ioctl(struct inode *inode, struct file *filp, 851static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
851 unsigned int cmd, unsigned long arg)
852{ 852{
853 static struct watchdog_info ident = { 853 static struct watchdog_info ident = {
854 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | 854 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
@@ -858,6 +858,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,
858 int i, ret = 0; 858 int i, ret = 0;
859 struct fschmd_data *data = filp->private_data; 859 struct fschmd_data *data = filp->private_data;
860 860
861 lock_kernel();
861 switch (cmd) { 862 switch (cmd) {
862 case WDIOC_GETSUPPORT: 863 case WDIOC_GETSUPPORT:
863 ident.firmware_version = data->revision; 864 ident.firmware_version = data->revision;
@@ -914,7 +915,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,
914 default: 915 default:
915 ret = -ENOTTY; 916 ret = -ENOTTY;
916 } 917 }
917 918 unlock_kernel();
918 return ret; 919 return ret;
919} 920}
920 921
@@ -924,7 +925,7 @@ static const struct file_operations watchdog_fops = {
924 .open = watchdog_open, 925 .open = watchdog_open,
925 .release = watchdog_release, 926 .release = watchdog_release,
926 .write = watchdog_write, 927 .write = watchdog_write,
927 .ioctl = watchdog_ioctl, 928 .unlocked_ioctl = watchdog_ioctl,
928}; 929};
929 930
930 931
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
index 612807d97155..697202e27891 100644
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -35,6 +35,7 @@
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/i2c.h> 36#include <linux/i2c.h>
37#include <linux/hwmon.h> 37#include <linux/hwmon.h>
38#include <linux/smp_lock.h>
38#include <linux/hwmon-vid.h> 39#include <linux/hwmon-vid.h>
39#include <linux/hwmon-sysfs.h> 40#include <linux/hwmon-sysfs.h>
40#include <linux/err.h> 41#include <linux/err.h>
@@ -1319,8 +1320,8 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf,
1319 return count; 1320 return count;
1320} 1321}
1321 1322
1322static int watchdog_ioctl(struct inode *inode, struct file *filp, 1323static long watchdog_ioctl(struct file *filp, unsigned int cmd,
1323 unsigned int cmd, unsigned long arg) 1324 unsigned long arg)
1324{ 1325{
1325 static struct watchdog_info ident = { 1326 static struct watchdog_info ident = {
1326 .options = WDIOF_KEEPALIVEPING | 1327 .options = WDIOF_KEEPALIVEPING |
@@ -1332,6 +1333,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,
1332 int val, ret = 0; 1333 int val, ret = 0;
1333 struct w83793_data *data = filp->private_data; 1334 struct w83793_data *data = filp->private_data;
1334 1335
1336 lock_kernel();
1335 switch (cmd) { 1337 switch (cmd) {
1336 case WDIOC_GETSUPPORT: 1338 case WDIOC_GETSUPPORT:
1337 if (!nowayout) 1339 if (!nowayout)
@@ -1385,7 +1387,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,
1385 default: 1387 default:
1386 ret = -ENOTTY; 1388 ret = -ENOTTY;
1387 } 1389 }
1388 1390 unlock_kernel();
1389 return ret; 1391 return ret;
1390} 1392}
1391 1393
@@ -1395,7 +1397,7 @@ static const struct file_operations watchdog_fops = {
1395 .open = watchdog_open, 1397 .open = watchdog_open,
1396 .release = watchdog_close, 1398 .release = watchdog_close,
1397 .write = watchdog_write, 1399 .write = watchdog_write,
1398 .ioctl = watchdog_ioctl, 1400 .unlocked_ioctl = watchdog_ioctl,
1399}; 1401};
1400 1402
1401/* 1403/*
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c
index ad730e15afc0..e00a1cc79c0a 100644
--- a/drivers/input/misc/hp_sdc_rtc.c
+++ b/drivers/input/misc/hp_sdc_rtc.c
@@ -43,6 +43,7 @@
43#include <linux/proc_fs.h> 43#include <linux/proc_fs.h>
44#include <linux/poll.h> 44#include <linux/poll.h>
45#include <linux/rtc.h> 45#include <linux/rtc.h>
46#include <linux/smp_lock.h>
46#include <linux/semaphore.h> 47#include <linux/semaphore.h>
47 48
48MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>"); 49MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>");
@@ -64,8 +65,8 @@ static DECLARE_WAIT_QUEUE_HEAD(hp_sdc_rtc_wait);
64static ssize_t hp_sdc_rtc_read(struct file *file, char __user *buf, 65static ssize_t hp_sdc_rtc_read(struct file *file, char __user *buf,
65 size_t count, loff_t *ppos); 66 size_t count, loff_t *ppos);
66 67
67static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file, 68static long hp_sdc_rtc_unlocked_ioctl(struct file *file,
68 unsigned int cmd, unsigned long arg); 69 unsigned int cmd, unsigned long arg);
69 70
70static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait); 71static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait);
71 72
@@ -512,7 +513,7 @@ static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off,
512 return len; 513 return len;
513} 514}
514 515
515static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file, 516static int hp_sdc_rtc_ioctl(struct file *file,
516 unsigned int cmd, unsigned long arg) 517 unsigned int cmd, unsigned long arg)
517{ 518{
518#if 1 519#if 1
@@ -659,14 +660,27 @@ static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file,
659#endif 660#endif
660} 661}
661 662
663static long hp_sdc_rtc_unlocked_ioctl(struct file *file,
664 unsigned int cmd, unsigned long arg)
665{
666 int ret;
667
668 lock_kernel();
669 ret = hp_sdc_rtc_ioctl(file, cmd, arg);
670 unlock_kernel();
671
672 return ret;
673}
674
675
662static const struct file_operations hp_sdc_rtc_fops = { 676static const struct file_operations hp_sdc_rtc_fops = {
663 .owner = THIS_MODULE, 677 .owner = THIS_MODULE,
664 .llseek = no_llseek, 678 .llseek = no_llseek,
665 .read = hp_sdc_rtc_read, 679 .read = hp_sdc_rtc_read,
666 .poll = hp_sdc_rtc_poll, 680 .poll = hp_sdc_rtc_poll,
667 .ioctl = hp_sdc_rtc_ioctl, 681 .unlocked_ioctl = hp_sdc_rtc_ioctl,
668 .open = hp_sdc_rtc_open, 682 .open = hp_sdc_rtc_open,
669 .fasync = hp_sdc_rtc_fasync, 683 .fasync = hp_sdc_rtc_fasync,
670}; 684};
671 685
672static struct miscdevice hp_sdc_rtc_dev = { 686static struct miscdevice hp_sdc_rtc_dev = {
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index ee5837522f5a..0cabe31f26df 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -787,8 +787,7 @@ capi_poll(struct file *file, poll_table * wait)
787} 787}
788 788
789static int 789static int
790capi_ioctl(struct inode *inode, struct file *file, 790capi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
791 unsigned int cmd, unsigned long arg)
792{ 791{
793 struct capidev *cdev = file->private_data; 792 struct capidev *cdev = file->private_data;
794 capi_ioctl_struct data; 793 capi_ioctl_struct data;
@@ -981,6 +980,18 @@ register_out:
981 } 980 }
982} 981}
983 982
983static long
984capi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
985{
986 int ret;
987
988 lock_kernel();
989 ret = capi_ioctl(file, cmd, arg);
990 unlock_kernel();
991
992 return ret;
993}
994
984static int capi_open(struct inode *inode, struct file *file) 995static int capi_open(struct inode *inode, struct file *file)
985{ 996{
986 struct capidev *cdev; 997 struct capidev *cdev;
@@ -1026,7 +1037,7 @@ static const struct file_operations capi_fops =
1026 .read = capi_read, 1037 .read = capi_read,
1027 .write = capi_write, 1038 .write = capi_write,
1028 .poll = capi_poll, 1039 .poll = capi_poll,
1029 .ioctl = capi_ioctl, 1040 .unlocked_ioctl = capi_unlocked_ioctl,
1030 .open = capi_open, 1041 .open = capi_open,
1031 .release = capi_release, 1042 .release = capi_release,
1032}; 1043};
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 70044ee4b228..a44cdb492ea9 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -1272,9 +1272,9 @@ isdn_poll(struct file *file, poll_table * wait)
1272 1272
1273 1273
1274static int 1274static int
1275isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) 1275isdn_ioctl(struct file *file, uint cmd, ulong arg)
1276{ 1276{
1277 uint minor = iminor(inode); 1277 uint minor = iminor(file->f_path.dentry->d_inode);
1278 isdn_ctrl c; 1278 isdn_ctrl c;
1279 int drvidx; 1279 int drvidx;
1280 int chidx; 1280 int chidx;
@@ -1722,6 +1722,18 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1722#undef cfg 1722#undef cfg
1723} 1723}
1724 1724
1725static long
1726isdn_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1727{
1728 int ret;
1729
1730 lock_kernel();
1731 ret = isdn_ioctl(file, cmd, arg);
1732 unlock_kernel();
1733
1734 return ret;
1735}
1736
1725/* 1737/*
1726 * Open the device code. 1738 * Open the device code.
1727 */ 1739 */
@@ -1838,7 +1850,7 @@ static const struct file_operations isdn_fops =
1838 .read = isdn_read, 1850 .read = isdn_read,
1839 .write = isdn_write, 1851 .write = isdn_write,
1840 .poll = isdn_poll, 1852 .poll = isdn_poll,
1841 .ioctl = isdn_ioctl, 1853 .unlocked_ioctl = isdn_unlocked_ioctl,
1842 .open = isdn_open, 1854 .open = isdn_open,
1843 .release = isdn_close, 1855 .release = isdn_close,
1844}; 1856};
diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c
index 8785004e85e0..c3243c913ec0 100644
--- a/drivers/isdn/mISDN/timerdev.c
+++ b/drivers/isdn/mISDN/timerdev.c
@@ -24,6 +24,7 @@
24#include <linux/miscdevice.h> 24#include <linux/miscdevice.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/mISDNif.h> 26#include <linux/mISDNif.h>
27#include <linux/smp_lock.h>
27#include "core.h" 28#include "core.h"
28 29
29static u_int *debug; 30static u_int *debug;
@@ -215,9 +216,8 @@ unlock:
215 return ret; 216 return ret;
216} 217}
217 218
218static int 219static long
219mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, 220mISDN_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
220 unsigned long arg)
221{ 221{
222 struct mISDNtimerdev *dev = filep->private_data; 222 struct mISDNtimerdev *dev = filep->private_data;
223 int id, tout, ret = 0; 223 int id, tout, ret = 0;
@@ -226,6 +226,7 @@ mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
226 if (*debug & DEBUG_TIMER) 226 if (*debug & DEBUG_TIMER)
227 printk(KERN_DEBUG "%s(%p, %x, %lx)\n", __func__, 227 printk(KERN_DEBUG "%s(%p, %x, %lx)\n", __func__,
228 filep, cmd, arg); 228 filep, cmd, arg);
229 lock_kernel();
229 switch (cmd) { 230 switch (cmd) {
230 case IMADDTIMER: 231 case IMADDTIMER:
231 if (get_user(tout, (int __user *)arg)) { 232 if (get_user(tout, (int __user *)arg)) {
@@ -257,13 +258,14 @@ mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
257 default: 258 default:
258 ret = -EINVAL; 259 ret = -EINVAL;
259 } 260 }
261 unlock_kernel();
260 return ret; 262 return ret;
261} 263}
262 264
263static const struct file_operations mISDN_fops = { 265static const struct file_operations mISDN_fops = {
264 .read = mISDN_read, 266 .read = mISDN_read,
265 .poll = mISDN_poll, 267 .poll = mISDN_poll,
266 .ioctl = mISDN_ioctl, 268 .unlocked_ioctl = mISDN_ioctl,
267 .open = mISDN_open, 269 .open = mISDN_open,
268 .release = mISDN_close, 270 .release = mISDN_close,
269}; 271};
diff --git a/drivers/macintosh/nvram.c b/drivers/macintosh/nvram.c
index c876349c32de..a271c8218d82 100644
--- a/drivers/macintosh/nvram.c
+++ b/drivers/macintosh/nvram.c
@@ -100,7 +100,7 @@ const struct file_operations nvram_fops = {
100 .llseek = nvram_llseek, 100 .llseek = nvram_llseek,
101 .read = read_nvram, 101 .read = read_nvram,
102 .write = write_nvram, 102 .write = write_nvram,
103 .ioctl = nvram_ioctl, 103 .unlocked_ioctl = nvram_ioctl,
104}; 104};
105 105
106static struct miscdevice nvram_dev = { 106static struct miscdevice nvram_dev = {
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 42764849eb78..3d4fc0f7b00b 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -2273,8 +2273,7 @@ static int register_pmu_pm_ops(void)
2273device_initcall(register_pmu_pm_ops); 2273device_initcall(register_pmu_pm_ops);
2274#endif 2274#endif
2275 2275
2276static int 2276static int pmu_ioctl(struct file *filp,
2277pmu_ioctl(struct inode * inode, struct file *filp,
2278 u_int cmd, u_long arg) 2277 u_int cmd, u_long arg)
2279{ 2278{
2280 __u32 __user *argp = (__u32 __user *)arg; 2279 __u32 __user *argp = (__u32 __user *)arg;
@@ -2337,11 +2336,23 @@ pmu_ioctl(struct inode * inode, struct file *filp,
2337 return error; 2336 return error;
2338} 2337}
2339 2338
2339static long pmu_unlocked_ioctl(struct file *filp,
2340 u_int cmd, u_long arg)
2341{
2342 int ret;
2343
2344 lock_kernel();
2345 ret = pmu_ioctl(filp, cmd, arg);
2346 unlock_kernel();
2347
2348 return ret;
2349}
2350
2340static const struct file_operations pmu_device_fops = { 2351static const struct file_operations pmu_device_fops = {
2341 .read = pmu_read, 2352 .read = pmu_read,
2342 .write = pmu_write, 2353 .write = pmu_write,
2343 .poll = pmu_fpoll, 2354 .poll = pmu_fpoll,
2344 .ioctl = pmu_ioctl, 2355 .unlocked_ioctl = pmu_unlocked_ioctl,
2345 .open = pmu_open, 2356 .open = pmu_open,
2346 .release = pmu_release, 2357 .release = pmu_release,
2347}; 2358};
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index 9ddc57909d49..425862ffb285 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -25,6 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/smp_lock.h>
28#include <linux/poll.h> 29#include <linux/poll.h>
29#include <linux/ioctl.h> 30#include <linux/ioctl.h>
30#include <linux/wait.h> 31#include <linux/wait.h>
@@ -963,7 +964,7 @@ dvb_demux_read(struct file *file, char __user *buf, size_t count,
963 return ret; 964 return ret;
964} 965}
965 966
966static int dvb_demux_do_ioctl(struct inode *inode, struct file *file, 967static int dvb_demux_do_ioctl(struct file *file,
967 unsigned int cmd, void *parg) 968 unsigned int cmd, void *parg)
968{ 969{
969 struct dmxdev_filter *dmxdevfilter = file->private_data; 970 struct dmxdev_filter *dmxdevfilter = file->private_data;
@@ -1084,10 +1085,16 @@ static int dvb_demux_do_ioctl(struct inode *inode, struct file *file,
1084 return ret; 1085 return ret;
1085} 1086}
1086 1087
1087static int dvb_demux_ioctl(struct inode *inode, struct file *file, 1088static long dvb_demux_ioctl(struct file *file, unsigned int cmd,
1088 unsigned int cmd, unsigned long arg) 1089 unsigned long arg)
1089{ 1090{
1090 return dvb_usercopy(inode, file, cmd, arg, dvb_demux_do_ioctl); 1091 int ret;
1092
1093 lock_kernel();
1094 ret = dvb_usercopy(file, cmd, arg, dvb_demux_do_ioctl);
1095 unlock_kernel();
1096
1097 return ret;
1091} 1098}
1092 1099
1093static unsigned int dvb_demux_poll(struct file *file, poll_table *wait) 1100static unsigned int dvb_demux_poll(struct file *file, poll_table *wait)
@@ -1139,7 +1146,7 @@ static int dvb_demux_release(struct inode *inode, struct file *file)
1139static const struct file_operations dvb_demux_fops = { 1146static const struct file_operations dvb_demux_fops = {
1140 .owner = THIS_MODULE, 1147 .owner = THIS_MODULE,
1141 .read = dvb_demux_read, 1148 .read = dvb_demux_read,
1142 .ioctl = dvb_demux_ioctl, 1149 .unlocked_ioctl = dvb_demux_ioctl,
1143 .open = dvb_demux_open, 1150 .open = dvb_demux_open,
1144 .release = dvb_demux_release, 1151 .release = dvb_demux_release,
1145 .poll = dvb_demux_poll, 1152 .poll = dvb_demux_poll,
@@ -1152,7 +1159,7 @@ static struct dvb_device dvbdev_demux = {
1152 .fops = &dvb_demux_fops 1159 .fops = &dvb_demux_fops
1153}; 1160};
1154 1161
1155static int dvb_dvr_do_ioctl(struct inode *inode, struct file *file, 1162static int dvb_dvr_do_ioctl(struct file *file,
1156 unsigned int cmd, void *parg) 1163 unsigned int cmd, void *parg)
1157{ 1164{
1158 struct dvb_device *dvbdev = file->private_data; 1165 struct dvb_device *dvbdev = file->private_data;
@@ -1176,10 +1183,16 @@ static int dvb_dvr_do_ioctl(struct inode *inode, struct file *file,
1176 return ret; 1183 return ret;
1177} 1184}
1178 1185
1179static int dvb_dvr_ioctl(struct inode *inode, struct file *file, 1186static long dvb_dvr_ioctl(struct file *file,
1180 unsigned int cmd, unsigned long arg) 1187 unsigned int cmd, unsigned long arg)
1181{ 1188{
1182 return dvb_usercopy(inode, file, cmd, arg, dvb_dvr_do_ioctl); 1189 int ret;
1190
1191 lock_kernel();
1192 ret = dvb_usercopy(file, cmd, arg, dvb_dvr_do_ioctl);
1193 unlock_kernel();
1194
1195 return ret;
1183} 1196}
1184 1197
1185static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait) 1198static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait)
@@ -1208,7 +1221,7 @@ static const struct file_operations dvb_dvr_fops = {
1208 .owner = THIS_MODULE, 1221 .owner = THIS_MODULE,
1209 .read = dvb_dvr_read, 1222 .read = dvb_dvr_read,
1210 .write = dvb_dvr_write, 1223 .write = dvb_dvr_write,
1211 .ioctl = dvb_dvr_ioctl, 1224 .unlocked_ioctl = dvb_dvr_ioctl,
1212 .open = dvb_dvr_open, 1225 .open = dvb_dvr_open,
1213 .release = dvb_dvr_release, 1226 .release = dvb_dvr_release,
1214 .poll = dvb_dvr_poll, 1227 .poll = dvb_dvr_poll,
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
index cb22da53bfb0..ef259a0718ac 100644
--- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -36,6 +36,7 @@
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/sched.h> 38#include <linux/sched.h>
39#include <linux/smp_lock.h>
39#include <linux/kthread.h> 40#include <linux/kthread.h>
40 41
41#include "dvb_ca_en50221.h" 42#include "dvb_ca_en50221.h"
@@ -1181,7 +1182,7 @@ static int dvb_ca_en50221_thread(void *data)
1181 * 1182 *
1182 * @return 0 on success, <0 on error. 1183 * @return 0 on success, <0 on error.
1183 */ 1184 */
1184static int dvb_ca_en50221_io_do_ioctl(struct inode *inode, struct file *file, 1185static int dvb_ca_en50221_io_do_ioctl(struct file *file,
1185 unsigned int cmd, void *parg) 1186 unsigned int cmd, void *parg)
1186{ 1187{
1187 struct dvb_device *dvbdev = file->private_data; 1188 struct dvb_device *dvbdev = file->private_data;
@@ -1255,10 +1256,16 @@ static int dvb_ca_en50221_io_do_ioctl(struct inode *inode, struct file *file,
1255 * 1256 *
1256 * @return 0 on success, <0 on error. 1257 * @return 0 on success, <0 on error.
1257 */ 1258 */
1258static int dvb_ca_en50221_io_ioctl(struct inode *inode, struct file *file, 1259static long dvb_ca_en50221_io_ioctl(struct file *file,
1259 unsigned int cmd, unsigned long arg) 1260 unsigned int cmd, unsigned long arg)
1260{ 1261{
1261 return dvb_usercopy(inode, file, cmd, arg, dvb_ca_en50221_io_do_ioctl); 1262 int ret;
1263
1264 lock_kernel();
1265 ret = dvb_usercopy(file, cmd, arg, dvb_ca_en50221_io_do_ioctl);
1266 unlock_kernel();
1267
1268 return ret;
1262} 1269}
1263 1270
1264 1271
@@ -1611,7 +1618,7 @@ static const struct file_operations dvb_ca_fops = {
1611 .owner = THIS_MODULE, 1618 .owner = THIS_MODULE,
1612 .read = dvb_ca_en50221_io_read, 1619 .read = dvb_ca_en50221_io_read,
1613 .write = dvb_ca_en50221_io_write, 1620 .write = dvb_ca_en50221_io_write,
1614 .ioctl = dvb_ca_en50221_io_ioctl, 1621 .unlocked_ioctl = dvb_ca_en50221_io_ioctl,
1615 .open = dvb_ca_en50221_io_open, 1622 .open = dvb_ca_en50221_io_open,
1616 .release = dvb_ca_en50221_io_release, 1623 .release = dvb_ca_en50221_io_release,
1617 .poll = dvb_ca_en50221_io_poll, 1624 .poll = dvb_ca_en50221_io_poll,
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 6932def4d266..44ae89ecef94 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -36,6 +36,7 @@
36#include <linux/list.h> 36#include <linux/list.h>
37#include <linux/freezer.h> 37#include <linux/freezer.h>
38#include <linux/jiffies.h> 38#include <linux/jiffies.h>
39#include <linux/smp_lock.h>
39#include <linux/kthread.h> 40#include <linux/kthread.h>
40#include <asm/processor.h> 41#include <asm/processor.h>
41 42
@@ -1195,14 +1196,14 @@ static void dtv_property_cache_submit(struct dvb_frontend *fe)
1195 } 1196 }
1196} 1197}
1197 1198
1198static int dvb_frontend_ioctl_legacy(struct inode *inode, struct file *file, 1199static int dvb_frontend_ioctl_legacy(struct file *file,
1199 unsigned int cmd, void *parg); 1200 unsigned int cmd, void *parg);
1200static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file, 1201static int dvb_frontend_ioctl_properties(struct file *file,
1201 unsigned int cmd, void *parg); 1202 unsigned int cmd, void *parg);
1202 1203
1203static int dtv_property_process_get(struct dvb_frontend *fe, 1204static int dtv_property_process_get(struct dvb_frontend *fe,
1204 struct dtv_property *tvp, 1205 struct dtv_property *tvp,
1205 struct inode *inode, struct file *file) 1206 struct file *file)
1206{ 1207{
1207 int r = 0; 1208 int r = 0;
1208 1209
@@ -1335,7 +1336,6 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
1335 1336
1336static int dtv_property_process_set(struct dvb_frontend *fe, 1337static int dtv_property_process_set(struct dvb_frontend *fe,
1337 struct dtv_property *tvp, 1338 struct dtv_property *tvp,
1338 struct inode *inode,
1339 struct file *file) 1339 struct file *file)
1340{ 1340{
1341 int r = 0; 1341 int r = 0;
@@ -1366,7 +1366,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
1366 dprintk("%s() Finalised property cache\n", __func__); 1366 dprintk("%s() Finalised property cache\n", __func__);
1367 dtv_property_cache_submit(fe); 1367 dtv_property_cache_submit(fe);
1368 1368
1369 r |= dvb_frontend_ioctl_legacy(inode, file, FE_SET_FRONTEND, 1369 r |= dvb_frontend_ioctl_legacy(file, FE_SET_FRONTEND,
1370 &fepriv->parameters); 1370 &fepriv->parameters);
1371 break; 1371 break;
1372 case DTV_FREQUENCY: 1372 case DTV_FREQUENCY:
@@ -1398,12 +1398,12 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
1398 break; 1398 break;
1399 case DTV_VOLTAGE: 1399 case DTV_VOLTAGE:
1400 fe->dtv_property_cache.voltage = tvp->u.data; 1400 fe->dtv_property_cache.voltage = tvp->u.data;
1401 r = dvb_frontend_ioctl_legacy(inode, file, FE_SET_VOLTAGE, 1401 r = dvb_frontend_ioctl_legacy(file, FE_SET_VOLTAGE,
1402 (void *)fe->dtv_property_cache.voltage); 1402 (void *)fe->dtv_property_cache.voltage);
1403 break; 1403 break;
1404 case DTV_TONE: 1404 case DTV_TONE:
1405 fe->dtv_property_cache.sectone = tvp->u.data; 1405 fe->dtv_property_cache.sectone = tvp->u.data;
1406 r = dvb_frontend_ioctl_legacy(inode, file, FE_SET_TONE, 1406 r = dvb_frontend_ioctl_legacy(file, FE_SET_TONE,
1407 (void *)fe->dtv_property_cache.sectone); 1407 (void *)fe->dtv_property_cache.sectone);
1408 break; 1408 break;
1409 case DTV_CODE_RATE_HP: 1409 case DTV_CODE_RATE_HP:
@@ -1487,7 +1487,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
1487 return r; 1487 return r;
1488} 1488}
1489 1489
1490static int dvb_frontend_ioctl(struct inode *inode, struct file *file, 1490static int dvb_frontend_ioctl(struct file *file,
1491 unsigned int cmd, void *parg) 1491 unsigned int cmd, void *parg)
1492{ 1492{
1493 struct dvb_device *dvbdev = file->private_data; 1493 struct dvb_device *dvbdev = file->private_data;
@@ -1509,17 +1509,17 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
1509 return -ERESTARTSYS; 1509 return -ERESTARTSYS;
1510 1510
1511 if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY)) 1511 if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY))
1512 err = dvb_frontend_ioctl_properties(inode, file, cmd, parg); 1512 err = dvb_frontend_ioctl_properties(file, cmd, parg);
1513 else { 1513 else {
1514 fe->dtv_property_cache.state = DTV_UNDEFINED; 1514 fe->dtv_property_cache.state = DTV_UNDEFINED;
1515 err = dvb_frontend_ioctl_legacy(inode, file, cmd, parg); 1515 err = dvb_frontend_ioctl_legacy(file, cmd, parg);
1516 } 1516 }
1517 1517
1518 up(&fepriv->sem); 1518 up(&fepriv->sem);
1519 return err; 1519 return err;
1520} 1520}
1521 1521
1522static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file, 1522static int dvb_frontend_ioctl_properties(struct file *file,
1523 unsigned int cmd, void *parg) 1523 unsigned int cmd, void *parg)
1524{ 1524{
1525 struct dvb_device *dvbdev = file->private_data; 1525 struct dvb_device *dvbdev = file->private_data;
@@ -1555,7 +1555,7 @@ static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file,
1555 } 1555 }
1556 1556
1557 for (i = 0; i < tvps->num; i++) { 1557 for (i = 0; i < tvps->num; i++) {
1558 (tvp + i)->result = dtv_property_process_set(fe, tvp + i, inode, file); 1558 (tvp + i)->result = dtv_property_process_set(fe, tvp + i, file);
1559 err |= (tvp + i)->result; 1559 err |= (tvp + i)->result;
1560 } 1560 }
1561 1561
@@ -1587,7 +1587,7 @@ static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file,
1587 } 1587 }
1588 1588
1589 for (i = 0; i < tvps->num; i++) { 1589 for (i = 0; i < tvps->num; i++) {
1590 (tvp + i)->result = dtv_property_process_get(fe, tvp + i, inode, file); 1590 (tvp + i)->result = dtv_property_process_get(fe, tvp + i, file);
1591 err |= (tvp + i)->result; 1591 err |= (tvp + i)->result;
1592 } 1592 }
1593 1593
@@ -1604,7 +1604,7 @@ out:
1604 return err; 1604 return err;
1605} 1605}
1606 1606
1607static int dvb_frontend_ioctl_legacy(struct inode *inode, struct file *file, 1607static int dvb_frontend_ioctl_legacy(struct file *file,
1608 unsigned int cmd, void *parg) 1608 unsigned int cmd, void *parg)
1609{ 1609{
1610 struct dvb_device *dvbdev = file->private_data; 1610 struct dvb_device *dvbdev = file->private_data;
@@ -2031,7 +2031,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)
2031 2031
2032static const struct file_operations dvb_frontend_fops = { 2032static const struct file_operations dvb_frontend_fops = {
2033 .owner = THIS_MODULE, 2033 .owner = THIS_MODULE,
2034 .ioctl = dvb_generic_ioctl, 2034 .unlocked_ioctl = dvb_generic_ioctl,
2035 .poll = dvb_frontend_poll, 2035 .poll = dvb_frontend_poll,
2036 .open = dvb_frontend_open, 2036 .open = dvb_frontend_open,
2037 .release = dvb_frontend_release 2037 .release = dvb_frontend_release
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c
index cccea412088b..f6dac2bb0ac6 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/drivers/media/dvb/dvb-core/dvb_net.c
@@ -59,6 +59,7 @@
59#include <linux/netdevice.h> 59#include <linux/netdevice.h>
60#include <linux/etherdevice.h> 60#include <linux/etherdevice.h>
61#include <linux/dvb/net.h> 61#include <linux/dvb/net.h>
62#include <linux/smp_lock.h>
62#include <linux/uio.h> 63#include <linux/uio.h>
63#include <asm/uaccess.h> 64#include <asm/uaccess.h>
64#include <linux/crc32.h> 65#include <linux/crc32.h>
@@ -1329,7 +1330,7 @@ static int dvb_net_remove_if(struct dvb_net *dvbnet, unsigned long num)
1329 return 0; 1330 return 0;
1330} 1331}
1331 1332
1332static int dvb_net_do_ioctl(struct inode *inode, struct file *file, 1333static int dvb_net_do_ioctl(struct file *file,
1333 unsigned int cmd, void *parg) 1334 unsigned int cmd, void *parg)
1334{ 1335{
1335 struct dvb_device *dvbdev = file->private_data; 1336 struct dvb_device *dvbdev = file->private_data;
@@ -1431,10 +1432,16 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
1431 return 0; 1432 return 0;
1432} 1433}
1433 1434
1434static int dvb_net_ioctl(struct inode *inode, struct file *file, 1435static long dvb_net_ioctl(struct file *file,
1435 unsigned int cmd, unsigned long arg) 1436 unsigned int cmd, unsigned long arg)
1436{ 1437{
1437 return dvb_usercopy(inode, file, cmd, arg, dvb_net_do_ioctl); 1438 int ret;
1439
1440 lock_kernel();
1441 ret = dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl);
1442 unlock_kernel();
1443
1444 return ret;
1438} 1445}
1439 1446
1440static int dvb_net_close(struct inode *inode, struct file *file) 1447static int dvb_net_close(struct inode *inode, struct file *file)
@@ -1455,7 +1462,7 @@ static int dvb_net_close(struct inode *inode, struct file *file)
1455 1462
1456static const struct file_operations dvb_net_fops = { 1463static const struct file_operations dvb_net_fops = {
1457 .owner = THIS_MODULE, 1464 .owner = THIS_MODULE,
1458 .ioctl = dvb_net_ioctl, 1465 .unlocked_ioctl = dvb_net_ioctl,
1459 .open = dvb_generic_open, 1466 .open = dvb_generic_open,
1460 .release = dvb_net_close, 1467 .release = dvb_net_close,
1461}; 1468};
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 94159b90f733..b915c39d782f 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -154,10 +154,11 @@ int dvb_generic_release(struct inode *inode, struct file *file)
154EXPORT_SYMBOL(dvb_generic_release); 154EXPORT_SYMBOL(dvb_generic_release);
155 155
156 156
157int dvb_generic_ioctl(struct inode *inode, struct file *file, 157long dvb_generic_ioctl(struct file *file,
158 unsigned int cmd, unsigned long arg) 158 unsigned int cmd, unsigned long arg)
159{ 159{
160 struct dvb_device *dvbdev = file->private_data; 160 struct dvb_device *dvbdev = file->private_data;
161 int ret;
161 162
162 if (!dvbdev) 163 if (!dvbdev)
163 return -ENODEV; 164 return -ENODEV;
@@ -165,7 +166,11 @@ int dvb_generic_ioctl(struct inode *inode, struct file *file,
165 if (!dvbdev->kernel_ioctl) 166 if (!dvbdev->kernel_ioctl)
166 return -EINVAL; 167 return -EINVAL;
167 168
168 return dvb_usercopy (inode, file, cmd, arg, dvbdev->kernel_ioctl); 169 lock_kernel();
170 ret = dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl);
171 unlock_kernel();
172
173 return ret;
169} 174}
170EXPORT_SYMBOL(dvb_generic_ioctl); 175EXPORT_SYMBOL(dvb_generic_ioctl);
171 176
@@ -377,9 +382,9 @@ EXPORT_SYMBOL(dvb_unregister_adapter);
377 define this as video_usercopy(). this will introduce a dependecy 382 define this as video_usercopy(). this will introduce a dependecy
378 to the v4l "videodev.o" module, which is unnecessary for some 383 to the v4l "videodev.o" module, which is unnecessary for some
379 cards (ie. the budget dvb-cards don't need the v4l module...) */ 384 cards (ie. the budget dvb-cards don't need the v4l module...) */
380int dvb_usercopy(struct inode *inode, struct file *file, 385int dvb_usercopy(struct file *file,
381 unsigned int cmd, unsigned long arg, 386 unsigned int cmd, unsigned long arg,
382 int (*func)(struct inode *inode, struct file *file, 387 int (*func)(struct file *file,
383 unsigned int cmd, void *arg)) 388 unsigned int cmd, void *arg))
384{ 389{
385 char sbuf[128]; 390 char sbuf[128];
@@ -416,7 +421,7 @@ int dvb_usercopy(struct inode *inode, struct file *file,
416 } 421 }
417 422
418 /* call driver */ 423 /* call driver */
419 if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD) 424 if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
420 err = -EINVAL; 425 err = -EINVAL;
421 426
422 if (err < 0) 427 if (err < 0)
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h
index f7b499d4a3c0..fcc6ae98745e 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.h
+++ b/drivers/media/dvb/dvb-core/dvbdev.h
@@ -116,8 +116,7 @@ struct dvb_device {
116 116
117 wait_queue_head_t wait_queue; 117 wait_queue_head_t wait_queue;
118 /* don't really need those !? -- FIXME: use video_usercopy */ 118 /* don't really need those !? -- FIXME: use video_usercopy */
119 int (*kernel_ioctl)(struct inode *inode, struct file *file, 119 int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg);
120 unsigned int cmd, void *arg);
121 120
122 void *priv; 121 void *priv;
123}; 122};
@@ -138,17 +137,15 @@ extern void dvb_unregister_device (struct dvb_device *dvbdev);
138 137
139extern int dvb_generic_open (struct inode *inode, struct file *file); 138extern int dvb_generic_open (struct inode *inode, struct file *file);
140extern int dvb_generic_release (struct inode *inode, struct file *file); 139extern int dvb_generic_release (struct inode *inode, struct file *file);
141extern int dvb_generic_ioctl (struct inode *inode, struct file *file, 140extern long dvb_generic_ioctl (struct file *file,
142 unsigned int cmd, unsigned long arg); 141 unsigned int cmd, unsigned long arg);
143 142
144/* we don't mess with video_usercopy() any more, 143/* we don't mess with video_usercopy() any more,
145we simply define out own dvb_usercopy(), which will hopefully become 144we simply define out own dvb_usercopy(), which will hopefully become
146generic_usercopy() someday... */ 145generic_usercopy() someday... */
147 146
148extern int dvb_usercopy(struct inode *inode, struct file *file, 147extern int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
149 unsigned int cmd, unsigned long arg, 148 int (*func)(struct file *file, unsigned int cmd, void *arg));
150 int (*func)(struct inode *inode, struct file *file,
151 unsigned int cmd, void *arg));
152 149
153/** generic DVB attach function. */ 150/** generic DVB attach function. */
154#ifdef CONFIG_MEDIA_ATTACH 151#ifdef CONFIG_MEDIA_ATTACH
diff --git a/drivers/media/dvb/firewire/firedtv-ci.c b/drivers/media/dvb/firewire/firedtv-ci.c
index 853e04b7cb36..d3c2cf60de76 100644
--- a/drivers/media/dvb/firewire/firedtv-ci.c
+++ b/drivers/media/dvb/firewire/firedtv-ci.c
@@ -175,8 +175,7 @@ static int fdtv_ca_send_msg(struct firedtv *fdtv, void *arg)
175 return err; 175 return err;
176} 176}
177 177
178static int fdtv_ca_ioctl(struct inode *inode, struct file *file, 178static int fdtv_ca_ioctl(struct file *file, unsigned int cmd, void *arg)
179 unsigned int cmd, void *arg)
180{ 179{
181 struct dvb_device *dvbdev = file->private_data; 180 struct dvb_device *dvbdev = file->private_data;
182 struct firedtv *fdtv = dvbdev->priv; 181 struct firedtv *fdtv = dvbdev->priv;
@@ -217,7 +216,7 @@ static unsigned int fdtv_ca_io_poll(struct file *file, poll_table *wait)
217 216
218static const struct file_operations fdtv_ca_fops = { 217static const struct file_operations fdtv_ca_fops = {
219 .owner = THIS_MODULE, 218 .owner = THIS_MODULE,
220 .ioctl = dvb_generic_ioctl, 219 .unlocked_ioctl = dvb_generic_ioctl,
221 .open = dvb_generic_open, 220 .open = dvb_generic_open,
222 .release = dvb_generic_release, 221 .release = dvb_generic_release,
223 .poll = fdtv_ca_io_poll, 222 .poll = fdtv_ca_io_poll,
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 38915591c6e5..a6be529eec5c 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -708,7 +708,7 @@ static void gpioirq(unsigned long cookie)
708 708
709 709
710#ifdef CONFIG_DVB_AV7110_OSD 710#ifdef CONFIG_DVB_AV7110_OSD
711static int dvb_osd_ioctl(struct inode *inode, struct file *file, 711static int dvb_osd_ioctl(struct file *file,
712 unsigned int cmd, void *parg) 712 unsigned int cmd, void *parg)
713{ 713{
714 struct dvb_device *dvbdev = file->private_data; 714 struct dvb_device *dvbdev = file->private_data;
@@ -727,7 +727,7 @@ static int dvb_osd_ioctl(struct inode *inode, struct file *file,
727 727
728static const struct file_operations dvb_osd_fops = { 728static const struct file_operations dvb_osd_fops = {
729 .owner = THIS_MODULE, 729 .owner = THIS_MODULE,
730 .ioctl = dvb_generic_ioctl, 730 .unlocked_ioctl = dvb_generic_ioctl,
731 .open = dvb_generic_open, 731 .open = dvb_generic_open,
732 .release = dvb_generic_release, 732 .release = dvb_generic_release,
733}; 733};
diff --git a/drivers/media/dvb/ttpci/av7110_av.c b/drivers/media/dvb/ttpci/av7110_av.c
index 53884814161c..13efba942dac 100644
--- a/drivers/media/dvb/ttpci/av7110_av.c
+++ b/drivers/media/dvb/ttpci/av7110_av.c
@@ -1089,7 +1089,7 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
1089} 1089}
1090 1090
1091 1091
1092static int dvb_video_ioctl(struct inode *inode, struct file *file, 1092static int dvb_video_ioctl(struct file *file,
1093 unsigned int cmd, void *parg) 1093 unsigned int cmd, void *parg)
1094{ 1094{
1095 struct dvb_device *dvbdev = file->private_data; 1095 struct dvb_device *dvbdev = file->private_data;
@@ -1297,7 +1297,7 @@ static int dvb_video_ioctl(struct inode *inode, struct file *file,
1297 return ret; 1297 return ret;
1298} 1298}
1299 1299
1300static int dvb_audio_ioctl(struct inode *inode, struct file *file, 1300static int dvb_audio_ioctl(struct file *file,
1301 unsigned int cmd, void *parg) 1301 unsigned int cmd, void *parg)
1302{ 1302{
1303 struct dvb_device *dvbdev = file->private_data; 1303 struct dvb_device *dvbdev = file->private_data;
@@ -1517,7 +1517,7 @@ static int dvb_audio_release(struct inode *inode, struct file *file)
1517static const struct file_operations dvb_video_fops = { 1517static const struct file_operations dvb_video_fops = {
1518 .owner = THIS_MODULE, 1518 .owner = THIS_MODULE,
1519 .write = dvb_video_write, 1519 .write = dvb_video_write,
1520 .ioctl = dvb_generic_ioctl, 1520 .unlocked_ioctl = dvb_generic_ioctl,
1521 .open = dvb_video_open, 1521 .open = dvb_video_open,
1522 .release = dvb_video_release, 1522 .release = dvb_video_release,
1523 .poll = dvb_video_poll, 1523 .poll = dvb_video_poll,
@@ -1535,7 +1535,7 @@ static struct dvb_device dvbdev_video = {
1535static const struct file_operations dvb_audio_fops = { 1535static const struct file_operations dvb_audio_fops = {
1536 .owner = THIS_MODULE, 1536 .owner = THIS_MODULE,
1537 .write = dvb_audio_write, 1537 .write = dvb_audio_write,
1538 .ioctl = dvb_generic_ioctl, 1538 .unlocked_ioctl = dvb_generic_ioctl,
1539 .open = dvb_audio_open, 1539 .open = dvb_audio_open,
1540 .release = dvb_audio_release, 1540 .release = dvb_audio_release,
1541 .poll = dvb_audio_poll, 1541 .poll = dvb_audio_poll,
diff --git a/drivers/media/dvb/ttpci/av7110_ca.c b/drivers/media/dvb/ttpci/av7110_ca.c
index ac7779c45c5b..4eba35a018e3 100644
--- a/drivers/media/dvb/ttpci/av7110_ca.c
+++ b/drivers/media/dvb/ttpci/av7110_ca.c
@@ -248,8 +248,7 @@ static unsigned int dvb_ca_poll (struct file *file, poll_table *wait)
248 return mask; 248 return mask;
249} 249}
250 250
251static int dvb_ca_ioctl(struct inode *inode, struct file *file, 251static int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
252 unsigned int cmd, void *parg)
253{ 252{
254 struct dvb_device *dvbdev = file->private_data; 253 struct dvb_device *dvbdev = file->private_data;
255 struct av7110 *av7110 = dvbdev->priv; 254 struct av7110 *av7110 = dvbdev->priv;
@@ -350,7 +349,7 @@ static const struct file_operations dvb_ca_fops = {
350 .owner = THIS_MODULE, 349 .owner = THIS_MODULE,
351 .read = dvb_ca_read, 350 .read = dvb_ca_read,
352 .write = dvb_ca_write, 351 .write = dvb_ca_write,
353 .ioctl = dvb_generic_ioctl, 352 .unlocked_ioctl = dvb_generic_ioctl,
354 .open = dvb_ca_open, 353 .open = dvb_ca_open,
355 .release = dvb_generic_release, 354 .release = dvb_generic_release,
356 .poll = dvb_ca_poll, 355 .poll = dvb_ca_poll,
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 8bb5e4a66328..000d65ea55a4 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -468,8 +468,7 @@ static int mtd_do_readoob(struct mtd_info *mtd, uint64_t start,
468 return ret; 468 return ret;
469} 469}
470 470
471static int mtd_ioctl(struct inode *inode, struct file *file, 471static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
472 u_int cmd, u_long arg)
473{ 472{
474 struct mtd_file_info *mfi = file->private_data; 473 struct mtd_file_info *mfi = file->private_data;
475 struct mtd_info *mtd = mfi->mtd; 474 struct mtd_info *mtd = mfi->mtd;
@@ -840,6 +839,17 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
840 return ret; 839 return ret;
841} /* memory_ioctl */ 840} /* memory_ioctl */
842 841
842static long mtd_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
843{
844 int ret;
845
846 lock_kernel();
847 ret = mtd_ioctl(file, cmd, arg);
848 unlock_kernel();
849
850 return ret;
851}
852
843#ifdef CONFIG_COMPAT 853#ifdef CONFIG_COMPAT
844 854
845struct mtd_oob_buf32 { 855struct mtd_oob_buf32 {
@@ -854,7 +864,6 @@ struct mtd_oob_buf32 {
854static long mtd_compat_ioctl(struct file *file, unsigned int cmd, 864static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
855 unsigned long arg) 865 unsigned long arg)
856{ 866{
857 struct inode *inode = file->f_path.dentry->d_inode;
858 struct mtd_file_info *mfi = file->private_data; 867 struct mtd_file_info *mfi = file->private_data;
859 struct mtd_info *mtd = mfi->mtd; 868 struct mtd_info *mtd = mfi->mtd;
860 void __user *argp = compat_ptr(arg); 869 void __user *argp = compat_ptr(arg);
@@ -892,7 +901,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
892 break; 901 break;
893 } 902 }
894 default: 903 default:
895 ret = mtd_ioctl(inode, file, cmd, (unsigned long)argp); 904 ret = mtd_ioctl(file, cmd, (unsigned long)argp);
896 } 905 }
897 906
898 unlock_kernel(); 907 unlock_kernel();
@@ -960,7 +969,7 @@ static const struct file_operations mtd_fops = {
960 .llseek = mtd_lseek, 969 .llseek = mtd_lseek,
961 .read = mtd_read, 970 .read = mtd_read,
962 .write = mtd_write, 971 .write = mtd_write,
963 .ioctl = mtd_ioctl, 972 .unlocked_ioctl = mtd_unlocked_ioctl,
964#ifdef CONFIG_COMPAT 973#ifdef CONFIG_COMPAT
965 .compat_ioctl = mtd_compat_ioctl, 974 .compat_ioctl = mtd_compat_ioctl,
966#endif 975#endif
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index ef0c5f133691..d007a2a03830 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -813,8 +813,7 @@ static u_int ds_poll(struct file *file, poll_table *wait)
813 813
814/*====================================================================*/ 814/*====================================================================*/
815 815
816static int ds_ioctl(struct inode *inode, struct file *file, 816static int ds_ioctl(struct file *file, u_int cmd, u_long arg)
817 u_int cmd, u_long arg)
818{ 817{
819 struct pcmcia_socket *s; 818 struct pcmcia_socket *s;
820 void __user *uarg = (char __user *)arg; 819 void __user *uarg = (char __user *)arg;
@@ -1021,13 +1020,25 @@ free_out:
1021 return err; 1020 return err;
1022} /* ds_ioctl */ 1021} /* ds_ioctl */
1023 1022
1023static long ds_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1024{
1025 int ret;
1026
1027 lock_kernel();
1028 ret = ds_ioctl(file, cmd, arg);
1029 unlock_kernel();
1030
1031 return ret;
1032}
1033
1034
1024/*====================================================================*/ 1035/*====================================================================*/
1025 1036
1026static const struct file_operations ds_fops = { 1037static const struct file_operations ds_fops = {
1027 .owner = THIS_MODULE, 1038 .owner = THIS_MODULE,
1028 .open = ds_open, 1039 .open = ds_open,
1029 .release = ds_release, 1040 .release = ds_release,
1030 .ioctl = ds_ioctl, 1041 .unlocked_ioctl = ds_unlocked_ioctl,
1031 .read = ds_read, 1042 .read = ds_read,
1032 .write = ds_write, 1043 .write = ds_write,
1033 .poll = ds_poll, 1044 .poll = ds_poll,
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 60fe266f0f49..038095d99976 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -623,7 +623,7 @@ static ssize_t wdt_read(struct file *file, char __user *buf,
623 * according to their available features. We only actually usefully support 623 * according to their available features. We only actually usefully support
624 * querying capabilities and current status. 624 * querying capabilities and current status.
625 */ 625 */
626static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 626static int wdt_ioctl(struct file *file, unsigned int cmd,
627 unsigned long arg) 627 unsigned long arg)
628{ 628{
629 int new_margin, rv; 629 int new_margin, rv;
@@ -676,6 +676,18 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
676 return -ENOTTY; 676 return -ENOTTY;
677} 677}
678 678
679static long wdt_unlocked_ioctl(struct file *file, unsigned int cmd,
680 unsigned long arg)
681{
682 int ret;
683
684 lock_kernel();
685 ret = wdt_ioctl(file, cmd, arg);
686 unlock_kernel();
687
688 return ret;
689}
690
679/** 691/**
680 * wdt_open: 692 * wdt_open:
681 * @inode: inode of device 693 * @inode: inode of device
@@ -736,7 +748,7 @@ static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
736static const struct file_operations wdt_fops = { 748static const struct file_operations wdt_fops = {
737 .owner = THIS_MODULE, 749 .owner = THIS_MODULE,
738 .read = wdt_read, 750 .read = wdt_read,
739 .ioctl = wdt_ioctl, 751 .unlocked_ioctl = wdt_unlocked_ioctl,
740 .write = wdt_write, 752 .write = wdt_write,
741 .open = wdt_open, 753 .open = wdt_open,
742 .release = wdt_release, 754 .release = wdt_release,
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index fc2f676e984d..d53e62ab09da 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -298,9 +298,9 @@ static int opromgetbootargs(void __user *argp, struct openpromio *op, int bufsiz
298/* 298/*
299 * SunOS and Solaris /dev/openprom ioctl calls. 299 * SunOS and Solaris /dev/openprom ioctl calls.
300 */ 300 */
301static int openprom_sunos_ioctl(struct inode * inode, struct file * file, 301static long openprom_sunos_ioctl(struct file * file,
302 unsigned int cmd, unsigned long arg, 302 unsigned int cmd, unsigned long arg,
303 struct device_node *dp) 303 struct device_node *dp)
304{ 304{
305 DATA *data = file->private_data; 305 DATA *data = file->private_data;
306 struct openpromio *opp = NULL; 306 struct openpromio *opp = NULL;
@@ -316,6 +316,8 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
316 if (bufsize < 0) 316 if (bufsize < 0)
317 return bufsize; 317 return bufsize;
318 318
319 lock_kernel();
320
319 switch (cmd) { 321 switch (cmd) {
320 case OPROMGETOPT: 322 case OPROMGETOPT:
321 case OPROMGETPROP: 323 case OPROMGETPROP:
@@ -365,6 +367,8 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
365 } 367 }
366 368
367 kfree(opp); 369 kfree(opp);
370 unlock_kernel();
371
368 return error; 372 return error;
369} 373}
370 374
@@ -547,13 +551,14 @@ static int opiocgetnext(unsigned int cmd, void __user *argp)
547 return 0; 551 return 0;
548} 552}
549 553
550static int openprom_bsd_ioctl(struct inode * inode, struct file * file, 554static int openprom_bsd_ioctl(struct file * file,
551 unsigned int cmd, unsigned long arg) 555 unsigned int cmd, unsigned long arg)
552{ 556{
553 DATA *data = (DATA *) file->private_data; 557 DATA *data = (DATA *) file->private_data;
554 void __user *argp = (void __user *)arg; 558 void __user *argp = (void __user *)arg;
555 int err; 559 int err;
556 560
561 lock_kernel();
557 switch (cmd) { 562 switch (cmd) {
558 case OPIOCGET: 563 case OPIOCGET:
559 err = opiocget(argp, data); 564 err = opiocget(argp, data);
@@ -570,10 +575,10 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
570 case OPIOCGETOPTNODE: 575 case OPIOCGETOPTNODE:
571 BUILD_BUG_ON(sizeof(phandle) != sizeof(int)); 576 BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
572 577
578 err = 0;
573 if (copy_to_user(argp, &options_node->phandle, sizeof(phandle))) 579 if (copy_to_user(argp, &options_node->phandle, sizeof(phandle)))
574 return -EFAULT; 580 err = -EFAULT;
575 581 break;
576 return 0;
577 582
578 case OPIOCGETNEXT: 583 case OPIOCGETNEXT:
579 case OPIOCGETCHILD: 584 case OPIOCGETCHILD:
@@ -581,9 +586,10 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
581 break; 586 break;
582 587
583 default: 588 default:
584 return -EINVAL; 589 err = -EINVAL;
585 590 break;
586 }; 591 };
592 unlock_kernel();
587 593
588 return err; 594 return err;
589} 595}
@@ -592,8 +598,8 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
592/* 598/*
593 * Handoff control to the correct ioctl handler. 599 * Handoff control to the correct ioctl handler.
594 */ 600 */
595static int openprom_ioctl(struct inode * inode, struct file * file, 601static long openprom_ioctl(struct file * file,
596 unsigned int cmd, unsigned long arg) 602 unsigned int cmd, unsigned long arg)
597{ 603{
598 DATA *data = (DATA *) file->private_data; 604 DATA *data = (DATA *) file->private_data;
599 605
@@ -602,14 +608,14 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
602 case OPROMNXTOPT: 608 case OPROMNXTOPT:
603 if ((file->f_mode & FMODE_READ) == 0) 609 if ((file->f_mode & FMODE_READ) == 0)
604 return -EPERM; 610 return -EPERM;
605 return openprom_sunos_ioctl(inode, file, cmd, arg, 611 return openprom_sunos_ioctl(file, cmd, arg,
606 options_node); 612 options_node);
607 613
608 case OPROMSETOPT: 614 case OPROMSETOPT:
609 case OPROMSETOPT2: 615 case OPROMSETOPT2:
610 if ((file->f_mode & FMODE_WRITE) == 0) 616 if ((file->f_mode & FMODE_WRITE) == 0)
611 return -EPERM; 617 return -EPERM;
612 return openprom_sunos_ioctl(inode, file, cmd, arg, 618 return openprom_sunos_ioctl(file, cmd, arg,
613 options_node); 619 options_node);
614 620
615 case OPROMNEXT: 621 case OPROMNEXT:
@@ -618,7 +624,7 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
618 case OPROMNXTPROP: 624 case OPROMNXTPROP:
619 if ((file->f_mode & FMODE_READ) == 0) 625 if ((file->f_mode & FMODE_READ) == 0)
620 return -EPERM; 626 return -EPERM;
621 return openprom_sunos_ioctl(inode, file, cmd, arg, 627 return openprom_sunos_ioctl(file, cmd, arg,
622 data->current_node); 628 data->current_node);
623 629
624 case OPROMU2P: 630 case OPROMU2P:
@@ -630,7 +636,7 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
630 case OPROMPATH2NODE: 636 case OPROMPATH2NODE:
631 if ((file->f_mode & FMODE_READ) == 0) 637 if ((file->f_mode & FMODE_READ) == 0)
632 return -EPERM; 638 return -EPERM;
633 return openprom_sunos_ioctl(inode, file, cmd, arg, NULL); 639 return openprom_sunos_ioctl(file, cmd, arg, NULL);
634 640
635 case OPIOCGET: 641 case OPIOCGET:
636 case OPIOCNEXTPROP: 642 case OPIOCNEXTPROP:
@@ -639,12 +645,12 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
639 case OPIOCGETCHILD: 645 case OPIOCGETCHILD:
640 if ((file->f_mode & FMODE_READ) == 0) 646 if ((file->f_mode & FMODE_READ) == 0)
641 return -EBADF; 647 return -EBADF;
642 return openprom_bsd_ioctl(inode,file,cmd,arg); 648 return openprom_bsd_ioctl(file,cmd,arg);
643 649
644 case OPIOCSET: 650 case OPIOCSET:
645 if ((file->f_mode & FMODE_WRITE) == 0) 651 if ((file->f_mode & FMODE_WRITE) == 0)
646 return -EBADF; 652 return -EBADF;
647 return openprom_bsd_ioctl(inode,file,cmd,arg); 653 return openprom_bsd_ioctl(file,cmd,arg);
648 654
649 default: 655 default:
650 return -EINVAL; 656 return -EINVAL;
@@ -676,7 +682,7 @@ static long openprom_compat_ioctl(struct file *file, unsigned int cmd,
676 case OPROMSETCUR: 682 case OPROMSETCUR:
677 case OPROMPCI2NODE: 683 case OPROMPCI2NODE:
678 case OPROMPATH2NODE: 684 case OPROMPATH2NODE:
679 rval = openprom_ioctl(file->f_path.dentry->d_inode, file, cmd, arg); 685 rval = openprom_ioctl(file, cmd, arg);
680 break; 686 break;
681 } 687 }
682 688
@@ -709,7 +715,7 @@ static int openprom_release(struct inode * inode, struct file * file)
709static const struct file_operations openprom_fops = { 715static const struct file_operations openprom_fops = {
710 .owner = THIS_MODULE, 716 .owner = THIS_MODULE,
711 .llseek = no_llseek, 717 .llseek = no_llseek,
712 .ioctl = openprom_ioctl, 718 .unlocked_ioctl = openprom_ioctl,
713 .compat_ioctl = openprom_compat_ioctl, 719 .compat_ioctl = openprom_compat_ioctl,
714 .open = openprom_open, 720 .open = openprom_open,
715 .release = openprom_release, 721 .release = openprom_release,
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 1bb774becf25..e20b7bdd4c78 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -125,7 +125,7 @@ static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_H
125static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id); 125static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id);
126static char *twa_aen_severity_lookup(unsigned char severity_code); 126static char *twa_aen_severity_lookup(unsigned char severity_code);
127static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id); 127static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id);
128static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); 128static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
129static int twa_chrdev_open(struct inode *inode, struct file *file); 129static int twa_chrdev_open(struct inode *inode, struct file *file);
130static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host); 130static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host);
131static void twa_free_request_id(TW_Device_Extension *tw_dev,int request_id); 131static void twa_free_request_id(TW_Device_Extension *tw_dev,int request_id);
@@ -220,7 +220,7 @@ static struct device_attribute *twa_host_attrs[] = {
220/* File operations struct for character device */ 220/* File operations struct for character device */
221static const struct file_operations twa_fops = { 221static const struct file_operations twa_fops = {
222 .owner = THIS_MODULE, 222 .owner = THIS_MODULE,
223 .ioctl = twa_chrdev_ioctl, 223 .unlocked_ioctl = twa_chrdev_ioctl,
224 .open = twa_chrdev_open, 224 .open = twa_chrdev_open,
225 .release = NULL 225 .release = NULL
226}; 226};
@@ -637,8 +637,9 @@ out:
637} /* End twa_check_srl() */ 637} /* End twa_check_srl() */
638 638
639/* This function handles ioctl for the character device */ 639/* This function handles ioctl for the character device */
640static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 640static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
641{ 641{
642 struct inode *inode = file->f_path.dentry->d_inode;
642 long timeout; 643 long timeout;
643 unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0; 644 unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0;
644 dma_addr_t dma_handle; 645 dma_addr_t dma_handle;
@@ -657,6 +658,8 @@ static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
657 int retval = TW_IOCTL_ERROR_OS_EFAULT; 658 int retval = TW_IOCTL_ERROR_OS_EFAULT;
658 void __user *argp = (void __user *)arg; 659 void __user *argp = (void __user *)arg;
659 660
661 lock_kernel();
662
660 /* Only let one of these through at a time */ 663 /* Only let one of these through at a time */
661 if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { 664 if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
662 retval = TW_IOCTL_ERROR_OS_EINTR; 665 retval = TW_IOCTL_ERROR_OS_EINTR;
@@ -876,6 +879,7 @@ out3:
876out2: 879out2:
877 mutex_unlock(&tw_dev->ioctl_lock); 880 mutex_unlock(&tw_dev->ioctl_lock);
878out: 881out:
882 unlock_kernel();
879 return retval; 883 return retval;
880} /* End twa_chrdev_ioctl() */ 884} /* End twa_chrdev_ioctl() */
881 885
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index d38000db9237..f481e734aad4 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -750,19 +750,22 @@ static void twl_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm
750 750
751/* This function handles ioctl for the character device 751/* This function handles ioctl for the character device
752 This interface is used by smartmontools open source software */ 752 This interface is used by smartmontools open source software */
753static int twl_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 753static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
754{ 754{
755 long timeout; 755 long timeout;
756 unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0; 756 unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0;
757 dma_addr_t dma_handle; 757 dma_addr_t dma_handle;
758 int request_id = 0; 758 int request_id = 0;
759 TW_Ioctl_Driver_Command driver_command; 759 TW_Ioctl_Driver_Command driver_command;
760 struct inode *inode = file->f_dentry->d_inode;
760 TW_Ioctl_Buf_Apache *tw_ioctl; 761 TW_Ioctl_Buf_Apache *tw_ioctl;
761 TW_Command_Full *full_command_packet; 762 TW_Command_Full *full_command_packet;
762 TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)]; 763 TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)];
763 int retval = -EFAULT; 764 int retval = -EFAULT;
764 void __user *argp = (void __user *)arg; 765 void __user *argp = (void __user *)arg;
765 766
767 lock_kernel();
768
766 /* Only let one of these through at a time */ 769 /* Only let one of these through at a time */
767 if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { 770 if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
768 retval = -EINTR; 771 retval = -EINTR;
@@ -858,6 +861,7 @@ out3:
858out2: 861out2:
859 mutex_unlock(&tw_dev->ioctl_lock); 862 mutex_unlock(&tw_dev->ioctl_lock);
860out: 863out:
864 unlock_kernel();
861 return retval; 865 return retval;
862} /* End twl_chrdev_ioctl() */ 866} /* End twl_chrdev_ioctl() */
863 867
@@ -884,7 +888,7 @@ out:
884/* File operations struct for character device */ 888/* File operations struct for character device */
885static const struct file_operations twl_fops = { 889static const struct file_operations twl_fops = {
886 .owner = THIS_MODULE, 890 .owner = THIS_MODULE,
887 .ioctl = twl_chrdev_ioctl, 891 .unlocked_ioctl = twl_chrdev_ioctl,
888 .open = twl_chrdev_open, 892 .open = twl_chrdev_open,
889 .release = NULL 893 .release = NULL
890}; 894};
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index d119a614bf7d..30d735ad35b5 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -881,7 +881,7 @@ static int tw_allocate_memory(TW_Device_Extension *tw_dev, int size, int which)
881} /* End tw_allocate_memory() */ 881} /* End tw_allocate_memory() */
882 882
883/* This function handles ioctl for the character device */ 883/* This function handles ioctl for the character device */
884static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 884static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
885{ 885{
886 int request_id; 886 int request_id;
887 dma_addr_t dma_handle; 887 dma_addr_t dma_handle;
@@ -889,6 +889,7 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
889 unsigned long flags; 889 unsigned long flags;
890 unsigned int data_buffer_length = 0; 890 unsigned int data_buffer_length = 0;
891 unsigned long data_buffer_length_adjusted = 0; 891 unsigned long data_buffer_length_adjusted = 0;
892 struct inode *inode = file->f_dentry->d_inode;
892 unsigned long *cpu_addr; 893 unsigned long *cpu_addr;
893 long timeout; 894 long timeout;
894 TW_New_Ioctl *tw_ioctl; 895 TW_New_Ioctl *tw_ioctl;
@@ -899,9 +900,12 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
899 900
900 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n"); 901 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n");
901 902
903 lock_kernel();
902 /* Only let one of these through at a time */ 904 /* Only let one of these through at a time */
903 if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) 905 if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
906 unlock_kernel();
904 return -EINTR; 907 return -EINTR;
908 }
905 909
906 /* First copy down the buffer length */ 910 /* First copy down the buffer length */
907 if (copy_from_user(&data_buffer_length, argp, sizeof(unsigned int))) 911 if (copy_from_user(&data_buffer_length, argp, sizeof(unsigned int)))
@@ -1030,6 +1034,7 @@ out2:
1030 dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle); 1034 dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle);
1031out: 1035out:
1032 mutex_unlock(&tw_dev->ioctl_lock); 1036 mutex_unlock(&tw_dev->ioctl_lock);
1037 unlock_kernel();
1033 return retval; 1038 return retval;
1034} /* End tw_chrdev_ioctl() */ 1039} /* End tw_chrdev_ioctl() */
1035 1040
@@ -1052,7 +1057,7 @@ static int tw_chrdev_open(struct inode *inode, struct file *file)
1052/* File operations struct for character device */ 1057/* File operations struct for character device */
1053static const struct file_operations tw_fops = { 1058static const struct file_operations tw_fops = {
1054 .owner = THIS_MODULE, 1059 .owner = THIS_MODULE,
1055 .ioctl = tw_chrdev_ioctl, 1060 .unlocked_ioctl = tw_chrdev_ioctl,
1056 .open = tw_chrdev_open, 1061 .open = tw_chrdev_open,
1057 .release = NULL 1062 .release = NULL
1058}; 1063};
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index e9373a2d14fa..33898b61fdb5 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -705,12 +705,17 @@ static int aac_cfg_open(struct inode *inode, struct file *file)
705 * Bugs: Needs to handle hot plugging 705 * Bugs: Needs to handle hot plugging
706 */ 706 */
707 707
708static int aac_cfg_ioctl(struct inode *inode, struct file *file, 708static long aac_cfg_ioctl(struct file *file,
709 unsigned int cmd, unsigned long arg) 709 unsigned int cmd, unsigned long arg)
710{ 710{
711 int ret;
711 if (!capable(CAP_SYS_RAWIO)) 712 if (!capable(CAP_SYS_RAWIO))
712 return -EPERM; 713 return -EPERM;
713 return aac_do_ioctl(file->private_data, cmd, (void __user *)arg); 714 lock_kernel();
715 ret = aac_do_ioctl(file->private_data, cmd, (void __user *)arg);
716 unlock_kernel();
717
718 return ret;
714} 719}
715 720
716#ifdef CONFIG_COMPAT 721#ifdef CONFIG_COMPAT
@@ -1029,7 +1034,7 @@ ssize_t aac_get_serial_number(struct device *device, char *buf)
1029 1034
1030static const struct file_operations aac_cfg_fops = { 1035static const struct file_operations aac_cfg_fops = {
1031 .owner = THIS_MODULE, 1036 .owner = THIS_MODULE,
1032 .ioctl = aac_cfg_ioctl, 1037 .unlocked_ioctl = aac_cfg_ioctl,
1033#ifdef CONFIG_COMPAT 1038#ifdef CONFIG_COMPAT
1034 .compat_ioctl = aac_compat_cfg_ioctl, 1039 .compat_ioctl = aac_compat_cfg_ioctl,
1035#endif 1040#endif
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 0435d044c9da..b0c576f84b28 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -114,12 +114,13 @@ static int hba_count = 0;
114 114
115static struct class *adpt_sysfs_class; 115static struct class *adpt_sysfs_class;
116 116
117static long adpt_unlocked_ioctl(struct file *, unsigned int, unsigned long);
117#ifdef CONFIG_COMPAT 118#ifdef CONFIG_COMPAT
118static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long); 119static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long);
119#endif 120#endif
120 121
121static const struct file_operations adpt_fops = { 122static const struct file_operations adpt_fops = {
122 .ioctl = adpt_ioctl, 123 .unlocked_ioctl = adpt_unlocked_ioctl,
123 .open = adpt_open, 124 .open = adpt_open,
124 .release = adpt_close, 125 .release = adpt_close,
125#ifdef CONFIG_COMPAT 126#ifdef CONFIG_COMPAT
@@ -2069,8 +2070,7 @@ static int adpt_system_info(void __user *buffer)
2069 return 0; 2070 return 0;
2070} 2071}
2071 2072
2072static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, 2073static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
2073 ulong arg)
2074{ 2074{
2075 int minor; 2075 int minor;
2076 int error = 0; 2076 int error = 0;
@@ -2153,6 +2153,20 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
2153 return error; 2153 return error;
2154} 2154}
2155 2155
2156static long adpt_unlocked_ioctl(struct file *file, uint cmd, ulong arg)
2157{
2158 struct inode *inode;
2159 long ret;
2160
2161 inode = file->f_dentry->d_inode;
2162
2163 lock_kernel();
2164 ret = adpt_ioctl(inode, file, cmd, arg);
2165 unlock_kernel();
2166
2167 return ret;
2168}
2169
2156#ifdef CONFIG_COMPAT 2170#ifdef CONFIG_COMPAT
2157static long compat_adpt_ioctl(struct file *file, 2171static long compat_adpt_ioctl(struct file *file,
2158 unsigned int cmd, unsigned long arg) 2172 unsigned int cmd, unsigned long arg)
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index a765fe7a55c3..f672d6213eea 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -180,8 +180,8 @@ static const char *gdth_ctr_name(gdth_ha_str *ha);
180 180
181static int gdth_open(struct inode *inode, struct file *filep); 181static int gdth_open(struct inode *inode, struct file *filep);
182static int gdth_close(struct inode *inode, struct file *filep); 182static int gdth_close(struct inode *inode, struct file *filep);
183static int gdth_ioctl(struct inode *inode, struct file *filep, 183static long gdth_unlocked_ioctl(struct file *filep, unsigned int cmd,
184 unsigned int cmd, unsigned long arg); 184 unsigned long arg);
185 185
186static void gdth_flush(gdth_ha_str *ha); 186static void gdth_flush(gdth_ha_str *ha);
187static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)); 187static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *));
@@ -369,7 +369,7 @@ MODULE_LICENSE("GPL");
369 369
370/* ioctl interface */ 370/* ioctl interface */
371static const struct file_operations gdth_fops = { 371static const struct file_operations gdth_fops = {
372 .ioctl = gdth_ioctl, 372 .unlocked_ioctl = gdth_unlocked_ioctl,
373 .open = gdth_open, 373 .open = gdth_open,
374 .release = gdth_close, 374 .release = gdth_close,
375}; 375};
@@ -4462,8 +4462,7 @@ free_fail:
4462 return rc; 4462 return rc;
4463} 4463}
4464 4464
4465static int gdth_ioctl(struct inode *inode, struct file *filep, 4465static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
4466 unsigned int cmd, unsigned long arg)
4467{ 4466{
4468 gdth_ha_str *ha; 4467 gdth_ha_str *ha;
4469 Scsi_Cmnd *scp; 4468 Scsi_Cmnd *scp;
@@ -4611,6 +4610,17 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
4611 return 0; 4610 return 0;
4612} 4611}
4613 4612
4613static long gdth_unlocked_ioctl(struct file *file, unsigned int cmd,
4614 unsigned long arg)
4615{
4616 int ret;
4617
4618 lock_kernel();
4619 ret = gdth_ioctl(file, cmd, arg);
4620 unlock_kernel();
4621
4622 return ret;
4623}
4614 4624
4615/* flush routine */ 4625/* flush routine */
4616static void gdth_flush(gdth_ha_str *ha) 4626static void gdth_flush(gdth_ha_str *ha)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 4bf7edca9e69..0b6e3228610a 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -91,12 +91,15 @@ static struct proc_dir_entry *mega_proc_dir_entry;
91/* For controller re-ordering */ 91/* For controller re-ordering */
92static struct mega_hbas mega_hbas[MAX_CONTROLLERS]; 92static struct mega_hbas mega_hbas[MAX_CONTROLLERS];
93 93
94static long
95megadev_unlocked_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
96
94/* 97/*
95 * The File Operations structure for the serial/ioctl interface of the driver 98 * The File Operations structure for the serial/ioctl interface of the driver
96 */ 99 */
97static const struct file_operations megadev_fops = { 100static const struct file_operations megadev_fops = {
98 .owner = THIS_MODULE, 101 .owner = THIS_MODULE,
99 .ioctl = megadev_ioctl, 102 .unlocked_ioctl = megadev_unlocked_ioctl,
100 .open = megadev_open, 103 .open = megadev_open,
101}; 104};
102 105
@@ -3302,8 +3305,7 @@ megadev_open (struct inode *inode, struct file *filep)
3302 * controller. 3305 * controller.
3303 */ 3306 */
3304static int 3307static int
3305megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, 3308megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
3306 unsigned long arg)
3307{ 3309{
3308 adapter_t *adapter; 3310 adapter_t *adapter;
3309 nitioctl_t uioc; 3311 nitioctl_t uioc;
@@ -3694,6 +3696,18 @@ freemem_and_return:
3694 return 0; 3696 return 0;
3695} 3697}
3696 3698
3699static long
3700megadev_unlocked_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
3701{
3702 int ret;
3703
3704 lock_kernel();
3705 ret = megadev_ioctl(filep, cmd, arg);
3706 unlock_kernel();
3707
3708 return ret;
3709}
3710
3697/** 3711/**
3698 * mega_m_to_n() 3712 * mega_m_to_n()
3699 * @arg - user address 3713 * @arg - user address
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h
index d310f49d077e..2b4a048cadf1 100644
--- a/drivers/scsi/megaraid.h
+++ b/drivers/scsi/megaraid.h
@@ -1013,8 +1013,7 @@ static void mega_8_to_40ld (mraid_inquiry *inquiry,
1013 mega_inquiry3 *enquiry3, mega_product_info *); 1013 mega_inquiry3 *enquiry3, mega_product_info *);
1014 1014
1015static int megadev_open (struct inode *, struct file *); 1015static int megadev_open (struct inode *, struct file *);
1016static int megadev_ioctl (struct inode *, struct file *, unsigned int, 1016static int megadev_ioctl (struct file *, unsigned int, unsigned long);
1017 unsigned long);
1018static int mega_m_to_n(void __user *, nitioctl_t *); 1017static int mega_m_to_n(void __user *, nitioctl_t *);
1019static int mega_n_to_m(void __user *, megacmd_t *); 1018static int mega_n_to_m(void __user *, megacmd_t *);
1020 1019
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index 36e0b7d05c1d..41f82f76d884 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -22,7 +22,7 @@
22 22
23// Entry points for char node driver 23// Entry points for char node driver
24static int mraid_mm_open(struct inode *, struct file *); 24static int mraid_mm_open(struct inode *, struct file *);
25static int mraid_mm_ioctl(struct inode *, struct file *, uint, unsigned long); 25static long mraid_mm_unlocked_ioctl(struct file *, uint, unsigned long);
26 26
27 27
28// routines to convert to and from the old the format 28// routines to convert to and from the old the format
@@ -70,7 +70,7 @@ static wait_queue_head_t wait_q;
70 70
71static const struct file_operations lsi_fops = { 71static const struct file_operations lsi_fops = {
72 .open = mraid_mm_open, 72 .open = mraid_mm_open,
73 .ioctl = mraid_mm_ioctl, 73 .unlocked_ioctl = mraid_mm_unlocked_ioctl,
74#ifdef CONFIG_COMPAT 74#ifdef CONFIG_COMPAT
75 .compat_ioctl = mraid_mm_compat_ioctl, 75 .compat_ioctl = mraid_mm_compat_ioctl,
76#endif 76#endif
@@ -110,8 +110,7 @@ mraid_mm_open(struct inode *inode, struct file *filep)
110 * @arg : user ioctl packet 110 * @arg : user ioctl packet
111 */ 111 */
112static int 112static int
113mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, 113mraid_mm_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
114 unsigned long arg)
115{ 114{
116 uioc_t *kioc; 115 uioc_t *kioc;
117 char signature[EXT_IOCTL_SIGN_SZ] = {0}; 116 char signature[EXT_IOCTL_SIGN_SZ] = {0};
@@ -218,6 +217,19 @@ mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
218 return rval; 217 return rval;
219} 218}
220 219
220static long
221mraid_mm_unlocked_ioctl(struct file *filep, unsigned int cmd,
222 unsigned long arg)
223{
224 int err;
225
226 /* inconsistant: mraid_mm_compat_ioctl doesn't take the BKL */
227 lock_kernel();
228 err = mraid_mm_ioctl(filep, cmd, arg);
229 unlock_kernel();
230
231 return err;
232}
221 233
222/** 234/**
223 * mraid_mm_get_adapter - Returns corresponding adapters for the mimd packet 235 * mraid_mm_get_adapter - Returns corresponding adapters for the mimd packet
@@ -1225,7 +1237,7 @@ mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd,
1225{ 1237{
1226 int err; 1238 int err;
1227 1239
1228 err = mraid_mm_ioctl(NULL, filep, cmd, arg); 1240 err = mraid_mm_ioctl(filep, cmd, arg);
1229 1241
1230 return err; 1242 return err;
1231} 1243}
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index b219118f8bd6..8dbf1c3afb7b 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -4932,7 +4932,7 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp)
4932 4932
4933 4933
4934/* The ioctl command */ 4934/* The ioctl command */
4935static int osst_ioctl(struct inode * inode,struct file * file, 4935static long osst_ioctl(struct file * file,
4936 unsigned int cmd_in, unsigned long arg) 4936 unsigned int cmd_in, unsigned long arg)
4937{ 4937{
4938 int i, cmd_nr, cmd_type, blk, retval = 0; 4938 int i, cmd_nr, cmd_type, blk, retval = 0;
@@ -4943,8 +4943,11 @@ static int osst_ioctl(struct inode * inode,struct file * file,
4943 char * name = tape_name(STp); 4943 char * name = tape_name(STp);
4944 void __user * p = (void __user *)arg; 4944 void __user * p = (void __user *)arg;
4945 4945
4946 if (mutex_lock_interruptible(&STp->lock)) 4946 lock_kernel();
4947 if (mutex_lock_interruptible(&STp->lock)) {
4948 unlock_kernel();
4947 return -ERESTARTSYS; 4949 return -ERESTARTSYS;
4950 }
4948 4951
4949#if DEBUG 4952#if DEBUG
4950 if (debugging && !STp->in_use) { 4953 if (debugging && !STp->in_use) {
@@ -5256,12 +5259,15 @@ static int osst_ioctl(struct inode * inode,struct file * file,
5256 5259
5257 mutex_unlock(&STp->lock); 5260 mutex_unlock(&STp->lock);
5258 5261
5259 return scsi_ioctl(STp->device, cmd_in, p); 5262 retval = scsi_ioctl(STp->device, cmd_in, p);
5263 unlock_kernel();
5264 return retval;
5260 5265
5261out: 5266out:
5262 if (SRpnt) osst_release_request(SRpnt); 5267 if (SRpnt) osst_release_request(SRpnt);
5263 5268
5264 mutex_unlock(&STp->lock); 5269 mutex_unlock(&STp->lock);
5270 unlock_kernel();
5265 5271
5266 return retval; 5272 return retval;
5267} 5273}
@@ -5613,7 +5619,7 @@ static const struct file_operations osst_fops = {
5613 .owner = THIS_MODULE, 5619 .owner = THIS_MODULE,
5614 .read = osst_read, 5620 .read = osst_read,
5615 .write = osst_write, 5621 .write = osst_write,
5616 .ioctl = osst_ioctl, 5622 .unlocked_ioctl = osst_ioctl,
5617#ifdef CONFIG_COMPAT 5623#ifdef CONFIG_COMPAT
5618 .compat_ioctl = osst_compat_ioctl, 5624 .compat_ioctl = osst_compat_ioctl,
5619#endif 5625#endif
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index dee1c96288d4..ef752b248c4d 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -758,8 +758,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
758} 758}
759 759
760static int 760static int
761sg_ioctl(struct inode *inode, struct file *filp, 761sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
762 unsigned int cmd_in, unsigned long arg)
763{ 762{
764 void __user *p = (void __user *)arg; 763 void __user *p = (void __user *)arg;
765 int __user *ip = p; 764 int __user *ip = p;
@@ -1078,6 +1077,18 @@ sg_ioctl(struct inode *inode, struct file *filp,
1078 } 1077 }
1079} 1078}
1080 1079
1080static long
1081sg_unlocked_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
1082{
1083 int ret;
1084
1085 lock_kernel();
1086 ret = sg_ioctl(filp, cmd_in, arg);
1087 unlock_kernel();
1088
1089 return ret;
1090}
1091
1081#ifdef CONFIG_COMPAT 1092#ifdef CONFIG_COMPAT
1082static long sg_compat_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) 1093static long sg_compat_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
1083{ 1094{
@@ -1322,7 +1333,7 @@ static const struct file_operations sg_fops = {
1322 .read = sg_read, 1333 .read = sg_read,
1323 .write = sg_write, 1334 .write = sg_write,
1324 .poll = sg_poll, 1335 .poll = sg_poll,
1325 .ioctl = sg_ioctl, 1336 .unlocked_ioctl = sg_unlocked_ioctl,
1326#ifdef CONFIG_COMPAT 1337#ifdef CONFIG_COMPAT
1327 .compat_ioctl = sg_compat_ioctl, 1338 .compat_ioctl = sg_compat_ioctl,
1328#endif 1339#endif
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index e7fa3644ba6a..61c76b13f0f1 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -954,8 +954,7 @@ static int mon_bin_queued(struct mon_reader_bin *rp)
954 954
955/* 955/*
956 */ 956 */
957static int mon_bin_ioctl(struct inode *inode, struct file *file, 957static int mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958 unsigned int cmd, unsigned long arg)
959{ 958{
960 struct mon_reader_bin *rp = file->private_data; 959 struct mon_reader_bin *rp = file->private_data;
961 // struct mon_bus* mbus = rp->r.m_bus; 960 // struct mon_bus* mbus = rp->r.m_bus;
@@ -1095,6 +1094,19 @@ static int mon_bin_ioctl(struct inode *inode, struct file *file,
1095 return ret; 1094 return ret;
1096} 1095}
1097 1096
1097static long mon_bin_unlocked_ioctl(struct file *file, unsigned int cmd,
1098 unsigned long arg)
1099{
1100 int ret;
1101
1102 lock_kernel();
1103 ret = mon_bin_ioctl(file, cmd, arg);
1104 unlock_kernel();
1105
1106 return ret;
1107}
1108
1109
1098#ifdef CONFIG_COMPAT 1110#ifdef CONFIG_COMPAT
1099static long mon_bin_compat_ioctl(struct file *file, 1111static long mon_bin_compat_ioctl(struct file *file,
1100 unsigned int cmd, unsigned long arg) 1112 unsigned int cmd, unsigned long arg)
@@ -1148,14 +1160,13 @@ static long mon_bin_compat_ioctl(struct file *file,
1148 return 0; 1160 return 0;
1149 1161
1150 case MON_IOCG_STATS: 1162 case MON_IOCG_STATS:
1151 return mon_bin_ioctl(NULL, file, cmd, 1163 return mon_bin_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
1152 (unsigned long) compat_ptr(arg));
1153 1164
1154 case MON_IOCQ_URB_LEN: 1165 case MON_IOCQ_URB_LEN:
1155 case MON_IOCQ_RING_SIZE: 1166 case MON_IOCQ_RING_SIZE:
1156 case MON_IOCT_RING_SIZE: 1167 case MON_IOCT_RING_SIZE:
1157 case MON_IOCH_MFLUSH: 1168 case MON_IOCH_MFLUSH:
1158 return mon_bin_ioctl(NULL, file, cmd, arg); 1169 return mon_bin_ioctl(file, cmd, arg);
1159 1170
1160 default: 1171 default:
1161 ; 1172 ;
@@ -1239,7 +1250,7 @@ static const struct file_operations mon_fops_binary = {
1239 .read = mon_bin_read, 1250 .read = mon_bin_read,
1240 /* .write = mon_text_write, */ 1251 /* .write = mon_text_write, */
1241 .poll = mon_bin_poll, 1252 .poll = mon_bin_poll,
1242 .ioctl = mon_bin_ioctl, 1253 .unlocked_ioctl = mon_bin_unlocked_ioctl,
1243#ifdef CONFIG_COMPAT 1254#ifdef CONFIG_COMPAT
1244 .compat_ioctl = mon_bin_compat_ioctl, 1255 .compat_ioctl = mon_bin_compat_ioctl,
1245#endif 1256#endif
diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c
index 1becdc3837e6..8ec94f15a738 100644
--- a/drivers/usb/mon/mon_stat.c
+++ b/drivers/usb/mon/mon_stat.c
@@ -11,6 +11,7 @@
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/usb.h> 12#include <linux/usb.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/smp_lock.h>
14#include <asm/uaccess.h> 15#include <asm/uaccess.h>
15 16
16#include "usb_mon.h" 17#include "usb_mon.h"
@@ -63,6 +64,6 @@ const struct file_operations mon_fops_stat = {
63 .read = mon_stat_read, 64 .read = mon_stat_read,
64 /* .write = mon_stat_write, */ 65 /* .write = mon_stat_write, */
65 /* .poll = mon_stat_poll, */ 66 /* .poll = mon_stat_poll, */
66 /* .ioctl = mon_stat_ioctl, */ 67 /* .unlocked_ioctl = mon_stat_ioctl, */
67 .release = mon_stat_release, 68 .release = mon_stat_release,
68}; 69};
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index e8e5e63ac950..db4117ed7803 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -18,13 +18,14 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/param.h> 19#include <linux/param.h>
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/smp_lock.h>
21#include "autofs_i.h" 22#include "autofs_i.h"
22 23
23static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *); 24static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *);
24static int autofs4_dir_unlink(struct inode *,struct dentry *); 25static int autofs4_dir_unlink(struct inode *,struct dentry *);
25static int autofs4_dir_rmdir(struct inode *,struct dentry *); 26static int autofs4_dir_rmdir(struct inode *,struct dentry *);
26static int autofs4_dir_mkdir(struct inode *,struct dentry *,int); 27static int autofs4_dir_mkdir(struct inode *,struct dentry *,int);
27static int autofs4_root_ioctl(struct inode *, struct file *,unsigned int,unsigned long); 28static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long);
28static int autofs4_dir_open(struct inode *inode, struct file *file); 29static int autofs4_dir_open(struct inode *inode, struct file *file);
29static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *); 30static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *);
30static void *autofs4_follow_link(struct dentry *, struct nameidata *); 31static void *autofs4_follow_link(struct dentry *, struct nameidata *);
@@ -38,7 +39,7 @@ const struct file_operations autofs4_root_operations = {
38 .read = generic_read_dir, 39 .read = generic_read_dir,
39 .readdir = dcache_readdir, 40 .readdir = dcache_readdir,
40 .llseek = dcache_dir_lseek, 41 .llseek = dcache_dir_lseek,
41 .ioctl = autofs4_root_ioctl, 42 .unlocked_ioctl = autofs4_root_ioctl,
42}; 43};
43 44
44const struct file_operations autofs4_dir_operations = { 45const struct file_operations autofs4_dir_operations = {
@@ -902,8 +903,8 @@ int is_autofs4_dentry(struct dentry *dentry)
902 * ioctl()'s on the root directory is the chief method for the daemon to 903 * ioctl()'s on the root directory is the chief method for the daemon to
903 * generate kernel reactions 904 * generate kernel reactions
904 */ 905 */
905static int autofs4_root_ioctl(struct inode *inode, struct file *filp, 906static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
906 unsigned int cmd, unsigned long arg) 907 unsigned int cmd, unsigned long arg)
907{ 908{
908 struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb); 909 struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb);
909 void __user *p = (void __user *)arg; 910 void __user *p = (void __user *)arg;
@@ -947,3 +948,16 @@ static int autofs4_root_ioctl(struct inode *inode, struct file *filp,
947 return -ENOSYS; 948 return -ENOSYS;
948 } 949 }
949} 950}
951
952static long autofs4_root_ioctl(struct file *filp,
953 unsigned int cmd, unsigned long arg)
954{
955 long ret;
956 struct inode *inode = filp->f_dentry->d_inode;
957
958 lock_kernel();
959 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
960 unlock_kernel();
961
962 return ret;
963}
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index 773f2ce9aa06..ca25d96d45c9 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Pioctl operations for Coda. 2 * Pioctl operations for Coda.
3 * Original version: (C) 1996 Peter Braam 3 * Original version: (C) 1996 Peter Braam
4 * Rewritten for Linux 2.1: (C) 1997 Carnegie Mellon University 4 * Rewritten for Linux 2.1: (C) 1997 Carnegie Mellon University
5 * 5 *
6 * Carnegie Mellon encourages users of this code to contribute improvements 6 * Carnegie Mellon encourages users of this code to contribute improvements
@@ -23,21 +23,22 @@
23#include <linux/coda_fs_i.h> 23#include <linux/coda_fs_i.h>
24#include <linux/coda_psdev.h> 24#include <linux/coda_psdev.h>
25 25
26#include <linux/smp_lock.h>
27
26/* pioctl ops */ 28/* pioctl ops */
27static int coda_ioctl_permission(struct inode *inode, int mask); 29static int coda_ioctl_permission(struct inode *inode, int mask);
28static int coda_pioctl(struct inode * inode, struct file * filp, 30static long coda_pioctl(struct file *filp, unsigned int cmd,
29 unsigned int cmd, unsigned long user_data); 31 unsigned long user_data);
30 32
31/* exported from this file */ 33/* exported from this file */
32const struct inode_operations coda_ioctl_inode_operations = 34const struct inode_operations coda_ioctl_inode_operations = {
33{
34 .permission = coda_ioctl_permission, 35 .permission = coda_ioctl_permission,
35 .setattr = coda_setattr, 36 .setattr = coda_setattr,
36}; 37};
37 38
38const struct file_operations coda_ioctl_operations = { 39const struct file_operations coda_ioctl_operations = {
39 .owner = THIS_MODULE, 40 .owner = THIS_MODULE,
40 .ioctl = coda_pioctl, 41 .unlocked_ioctl = coda_pioctl,
41}; 42};
42 43
43/* the coda pioctl inode ops */ 44/* the coda pioctl inode ops */
@@ -46,48 +47,53 @@ static int coda_ioctl_permission(struct inode *inode, int mask)
46 return (mask & MAY_EXEC) ? -EACCES : 0; 47 return (mask & MAY_EXEC) ? -EACCES : 0;
47} 48}
48 49
49static int coda_pioctl(struct inode * inode, struct file * filp, 50static long coda_pioctl(struct file *filp, unsigned int cmd,
50 unsigned int cmd, unsigned long user_data) 51 unsigned long user_data)
51{ 52{
52 struct path path; 53 struct path path;
53 int error; 54 int error;
54 struct PioctlData data; 55 struct PioctlData data;
55 struct inode *target_inode = NULL; 56 struct inode *inode = filp->f_dentry->d_inode;
56 struct coda_inode_info *cnp; 57 struct inode *target_inode = NULL;
58 struct coda_inode_info *cnp;
57 59
58 /* get the Pioctl data arguments from user space */ 60 lock_kernel();
59 if (copy_from_user(&data, (void __user *)user_data, sizeof(data))) { 61
60 return -EINVAL; 62 /* get the Pioctl data arguments from user space */
61 } 63 if (copy_from_user(&data, (void __user *)user_data, sizeof(data))) {
62 64 error = -EINVAL;
63 /* 65 goto out;
64 * Look up the pathname. Note that the pathname is in
65 * user memory, and namei takes care of this
66 */
67 if (data.follow) {
68 error = user_path(data.path, &path);
69 } else {
70 error = user_lpath(data.path, &path);
71 } 66 }
72 67
73 if ( error ) { 68 /*
74 return error; 69 * Look up the pathname. Note that the pathname is in
75 } else { 70 * user memory, and namei takes care of this
71 */
72 if (data.follow)
73 error = user_path(data.path, &path);
74 else
75 error = user_lpath(data.path, &path);
76
77 if (error)
78 goto out;
79 else
76 target_inode = path.dentry->d_inode; 80 target_inode = path.dentry->d_inode;
77 } 81
78
79 /* return if it is not a Coda inode */ 82 /* return if it is not a Coda inode */
80 if ( target_inode->i_sb != inode->i_sb ) { 83 if (target_inode->i_sb != inode->i_sb) {
81 path_put(&path); 84 path_put(&path);
82 return -EINVAL; 85 error = -EINVAL;
86 goto out;
83 } 87 }
84 88
85 /* now proceed to make the upcall */ 89 /* now proceed to make the upcall */
86 cnp = ITOC(target_inode); 90 cnp = ITOC(target_inode);
87 91
88 error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data); 92 error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data);
89 93
90 path_put(&path); 94 path_put(&path);
91 return error;
92}
93 95
96out:
97 unlock_kernel();
98 return error;
99}
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index be4392ca2098..66b9cf79c5ba 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -73,8 +73,7 @@ static unsigned int coda_psdev_poll(struct file *file, poll_table * wait)
73 return mask; 73 return mask;
74} 74}
75 75
76static int coda_psdev_ioctl(struct inode * inode, struct file * filp, 76static long coda_psdev_ioctl(struct file * filp, unsigned int cmd, unsigned long arg)
77 unsigned int cmd, unsigned long arg)
78{ 77{
79 unsigned int data; 78 unsigned int data;
80 79
@@ -344,7 +343,7 @@ static const struct file_operations coda_psdev_fops = {
344 .read = coda_psdev_read, 343 .read = coda_psdev_read,
345 .write = coda_psdev_write, 344 .write = coda_psdev_write,
346 .poll = coda_psdev_poll, 345 .poll = coda_psdev_poll,
347 .ioctl = coda_psdev_ioctl, 346 .unlocked_ioctl = coda_psdev_ioctl,
348 .open = coda_psdev_open, 347 .open = coda_psdev_open,
349 .release = coda_psdev_release, 348 .release = coda_psdev_release,
350}; 349};
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 5f4023678251..764fd1bdca88 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -494,7 +494,7 @@ const struct inode_operations hfsplus_dir_inode_operations = {
494const struct file_operations hfsplus_dir_operations = { 494const struct file_operations hfsplus_dir_operations = {
495 .read = generic_read_dir, 495 .read = generic_read_dir,
496 .readdir = hfsplus_readdir, 496 .readdir = hfsplus_readdir,
497 .ioctl = hfsplus_ioctl, 497 .unlocked_ioctl = hfsplus_ioctl,
498 .llseek = generic_file_llseek, 498 .llseek = generic_file_llseek,
499 .release = hfsplus_dir_release, 499 .release = hfsplus_dir_release,
500}; 500};
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 5c10d803d9df..6505c30ad965 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -337,8 +337,7 @@ struct inode *hfsplus_new_inode(struct super_block *, int);
337void hfsplus_delete_inode(struct inode *); 337void hfsplus_delete_inode(struct inode *);
338 338
339/* ioctl.c */ 339/* ioctl.c */
340int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 340long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
341 unsigned long arg);
342int hfsplus_setxattr(struct dentry *dentry, const char *name, 341int hfsplus_setxattr(struct dentry *dentry, const char *name,
343 const void *value, size_t size, int flags); 342 const void *value, size_t size, int flags);
344ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, 343ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 1bcf597c0562..9bbb82924a22 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -285,7 +285,7 @@ static const struct file_operations hfsplus_file_operations = {
285 .fsync = file_fsync, 285 .fsync = file_fsync,
286 .open = hfsplus_file_open, 286 .open = hfsplus_file_open,
287 .release = hfsplus_file_release, 287 .release = hfsplus_file_release,
288 .ioctl = hfsplus_ioctl, 288 .unlocked_ioctl = hfsplus_ioctl,
289}; 289};
290 290
291struct inode *hfsplus_new_inode(struct super_block *sb, int mode) 291struct inode *hfsplus_new_inode(struct super_block *sb, int mode)
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index f457d2ca51ab..ac405f099026 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -17,14 +17,16 @@
17#include <linux/mount.h> 17#include <linux/mount.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/xattr.h> 19#include <linux/xattr.h>
20#include <linux/smp_lock.h>
20#include <asm/uaccess.h> 21#include <asm/uaccess.h>
21#include "hfsplus_fs.h" 22#include "hfsplus_fs.h"
22 23
23int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 24long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
24 unsigned long arg)
25{ 25{
26 struct inode *inode = filp->f_path.dentry->d_inode;
26 unsigned int flags; 27 unsigned int flags;
27 28
29 lock_kernel();
28 switch (cmd) { 30 switch (cmd) {
29 case HFSPLUS_IOC_EXT2_GETFLAGS: 31 case HFSPLUS_IOC_EXT2_GETFLAGS:
30 flags = 0; 32 flags = 0;
@@ -38,8 +40,10 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
38 case HFSPLUS_IOC_EXT2_SETFLAGS: { 40 case HFSPLUS_IOC_EXT2_SETFLAGS: {
39 int err = 0; 41 int err = 0;
40 err = mnt_want_write(filp->f_path.mnt); 42 err = mnt_want_write(filp->f_path.mnt);
41 if (err) 43 if (err) {
44 unlock_kernel();
42 return err; 45 return err;
46 }
43 47
44 if (!is_owner_or_cap(inode)) { 48 if (!is_owner_or_cap(inode)) {
45 err = -EACCES; 49 err = -EACCES;
@@ -85,9 +89,11 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
85 mark_inode_dirty(inode); 89 mark_inode_dirty(inode);
86setflags_out: 90setflags_out:
87 mnt_drop_write(filp->f_path.mnt); 91 mnt_drop_write(filp->f_path.mnt);
92 unlock_kernel();
88 return err; 93 return err;
89 } 94 }
90 default: 95 default:
96 unlock_kernel();
91 return -ENOTTY; 97 return -ENOTTY;
92 } 98 }
93} 99}
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 7edfcd4d5e52..92dde6f8d893 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -51,7 +51,7 @@ const struct file_operations ncp_dir_operations =
51{ 51{
52 .read = generic_read_dir, 52 .read = generic_read_dir,
53 .readdir = ncp_readdir, 53 .readdir = ncp_readdir,
54 .ioctl = ncp_ioctl, 54 .unlocked_ioctl = ncp_ioctl,
55#ifdef CONFIG_COMPAT 55#ifdef CONFIG_COMPAT
56 .compat_ioctl = ncp_compat_ioctl, 56 .compat_ioctl = ncp_compat_ioctl,
57#endif 57#endif
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c
index 1daabb90e0a5..b93870892892 100644
--- a/fs/ncpfs/file.c
+++ b/fs/ncpfs/file.c
@@ -295,7 +295,7 @@ const struct file_operations ncp_file_operations =
295 .llseek = ncp_remote_llseek, 295 .llseek = ncp_remote_llseek,
296 .read = ncp_file_read, 296 .read = ncp_file_read,
297 .write = ncp_file_write, 297 .write = ncp_file_write,
298 .ioctl = ncp_ioctl, 298 .unlocked_ioctl = ncp_ioctl,
299#ifdef CONFIG_COMPAT 299#ifdef CONFIG_COMPAT
300 .compat_ioctl = ncp_compat_ioctl, 300 .compat_ioctl = ncp_compat_ioctl,
301#endif 301#endif
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 60a5e2864ea8..023c03d02070 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -20,6 +20,7 @@
20#include <linux/smp_lock.h> 20#include <linux/smp_lock.h>
21#include <linux/vmalloc.h> 21#include <linux/vmalloc.h>
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/smp_lock.h>
23 24
24#include <linux/ncp_fs.h> 25#include <linux/ncp_fs.h>
25 26
@@ -261,9 +262,9 @@ ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg)
261} 262}
262#endif /* CONFIG_NCPFS_NLS */ 263#endif /* CONFIG_NCPFS_NLS */
263 264
264static int __ncp_ioctl(struct inode *inode, struct file *filp, 265static long __ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
265 unsigned int cmd, unsigned long arg)
266{ 266{
267 struct inode *inode = filp->f_dentry->d_inode;
267 struct ncp_server *server = NCP_SERVER(inode); 268 struct ncp_server *server = NCP_SERVER(inode);
268 int result; 269 int result;
269 struct ncp_ioctl_request request; 270 struct ncp_ioctl_request request;
@@ -841,11 +842,11 @@ static int ncp_ioctl_need_write(unsigned int cmd)
841 } 842 }
842} 843}
843 844
844int ncp_ioctl(struct inode *inode, struct file *filp, 845long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
845 unsigned int cmd, unsigned long arg)
846{ 846{
847 int ret; 847 long ret;
848 848
849 lock_kernel();
849 if (ncp_ioctl_need_write(cmd)) { 850 if (ncp_ioctl_need_write(cmd)) {
850 /* 851 /*
851 * inside the ioctl(), any failures which 852 * inside the ioctl(), any failures which
@@ -853,24 +854,28 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
853 * -EACCESS, so it seems consistent to keep 854 * -EACCESS, so it seems consistent to keep
854 * that here. 855 * that here.
855 */ 856 */
856 if (mnt_want_write(filp->f_path.mnt)) 857 if (mnt_want_write(filp->f_path.mnt)) {
857 return -EACCES; 858 ret = -EACCES;
859 goto out;
860 }
858 } 861 }
859 ret = __ncp_ioctl(inode, filp, cmd, arg); 862 ret = __ncp_ioctl(filp, cmd, arg);
860 if (ncp_ioctl_need_write(cmd)) 863 if (ncp_ioctl_need_write(cmd))
861 mnt_drop_write(filp->f_path.mnt); 864 mnt_drop_write(filp->f_path.mnt);
865
866out:
867 unlock_kernel();
862 return ret; 868 return ret;
863} 869}
864 870
865#ifdef CONFIG_COMPAT 871#ifdef CONFIG_COMPAT
866long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 872long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
867{ 873{
868 struct inode *inode = file->f_path.dentry->d_inode; 874 long ret;
869 int ret;
870 875
871 lock_kernel(); 876 lock_kernel();
872 arg = (unsigned long) compat_ptr(arg); 877 arg = (unsigned long) compat_ptr(arg);
873 ret = ncp_ioctl(inode, file, cmd, arg); 878 ret = ncp_ioctl(file, cmd, arg);
874 unlock_kernel(); 879 unlock_kernel();
875 return ret; 880 return ret;
876} 881}
diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c
index 3e4803b4427e..6c978428892d 100644
--- a/fs/smbfs/dir.c
+++ b/fs/smbfs/dir.c
@@ -39,7 +39,7 @@ const struct file_operations smb_dir_operations =
39{ 39{
40 .read = generic_read_dir, 40 .read = generic_read_dir,
41 .readdir = smb_readdir, 41 .readdir = smb_readdir,
42 .ioctl = smb_ioctl, 42 .unlocked_ioctl = smb_ioctl,
43 .open = smb_dir_open, 43 .open = smb_dir_open,
44}; 44};
45 45
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
index dbf6548bbf06..84ecf0e43f91 100644
--- a/fs/smbfs/file.c
+++ b/fs/smbfs/file.c
@@ -437,7 +437,7 @@ const struct file_operations smb_file_operations =
437 .aio_read = smb_file_aio_read, 437 .aio_read = smb_file_aio_read,
438 .write = do_sync_write, 438 .write = do_sync_write,
439 .aio_write = smb_file_aio_write, 439 .aio_write = smb_file_aio_write,
440 .ioctl = smb_ioctl, 440 .unlocked_ioctl = smb_ioctl,
441 .mmap = smb_file_mmap, 441 .mmap = smb_file_mmap,
442 .open = smb_file_open, 442 .open = smb_file_open,
443 .release = smb_file_release, 443 .release = smb_file_release,
diff --git a/fs/smbfs/ioctl.c b/fs/smbfs/ioctl.c
index dbae1f8ea26f..07215312ad39 100644
--- a/fs/smbfs/ioctl.c
+++ b/fs/smbfs/ioctl.c
@@ -13,6 +13,7 @@
13#include <linux/time.h> 13#include <linux/time.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/highuid.h> 15#include <linux/highuid.h>
16#include <linux/smp_lock.h>
16#include <linux/net.h> 17#include <linux/net.h>
17 18
18#include <linux/smb_fs.h> 19#include <linux/smb_fs.h>
@@ -22,14 +23,14 @@
22 23
23#include "proto.h" 24#include "proto.h"
24 25
25int 26long
26smb_ioctl(struct inode *inode, struct file *filp, 27smb_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
27 unsigned int cmd, unsigned long arg)
28{ 28{
29 struct smb_sb_info *server = server_from_inode(inode); 29 struct smb_sb_info *server = server_from_inode(filp->f_path.dentry->d_inode);
30 struct smb_conn_opt opt; 30 struct smb_conn_opt opt;
31 int result = -EINVAL; 31 int result = -EINVAL;
32 32
33 lock_kernel();
33 switch (cmd) { 34 switch (cmd) {
34 uid16_t uid16; 35 uid16_t uid16;
35 uid_t uid32; 36 uid_t uid32;
@@ -62,6 +63,7 @@ smb_ioctl(struct inode *inode, struct file *filp,
62 default: 63 default:
63 break; 64 break;
64 } 65 }
66 unlock_kernel();
65 67
66 return result; 68 return result;
67} 69}
diff --git a/fs/smbfs/proto.h b/fs/smbfs/proto.h
index 03f456c1b7d4..05939a6f43e6 100644
--- a/fs/smbfs/proto.h
+++ b/fs/smbfs/proto.h
@@ -67,7 +67,7 @@ extern const struct address_space_operations smb_file_aops;
67extern const struct file_operations smb_file_operations; 67extern const struct file_operations smb_file_operations;
68extern const struct inode_operations smb_file_inode_operations; 68extern const struct inode_operations smb_file_inode_operations;
69/* ioctl.c */ 69/* ioctl.c */
70extern int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); 70extern long smb_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
71/* smbiod.c */ 71/* smbiod.c */
72extern void smbiod_wake_up(void); 72extern void smbiod_wake_up(void);
73extern int smbiod_register_server(struct smb_sb_info *server); 73extern int smbiod_register_server(struct smb_sb_info *server);
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 30b06c893944..4522aed00906 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -210,7 +210,7 @@ int ncp_date_dos2unix(__le16 time, __le16 date);
210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
211 211
212/* linux/fs/ncpfs/ioctl.c */ 212/* linux/fs/ncpfs/ioctl.c */
213int ncp_ioctl(struct inode *, struct file *, unsigned int, unsigned long); 213long ncp_ioctl(struct file *, unsigned int, unsigned long);
214long ncp_compat_ioctl(struct file *, unsigned int, unsigned long); 214long ncp_compat_ioctl(struct file *, unsigned int, unsigned long);
215 215
216/* linux/fs/ncpfs/sock.c */ 216/* linux/fs/ncpfs/sock.c */
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index c2173ebdb33c..58de76c8540c 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -34,6 +34,7 @@
34#include <linux/sunrpc/cache.h> 34#include <linux/sunrpc/cache.h>
35#include <linux/sunrpc/stats.h> 35#include <linux/sunrpc/stats.h>
36#include <linux/sunrpc/rpc_pipe_fs.h> 36#include <linux/sunrpc/rpc_pipe_fs.h>
37#include <linux/smp_lock.h>
37 38
38#define RPCDBG_FACILITY RPCDBG_CACHE 39#define RPCDBG_FACILITY RPCDBG_CACHE
39 40
@@ -1545,12 +1546,18 @@ static unsigned int cache_poll_pipefs(struct file *filp, poll_table *wait)
1545 return cache_poll(filp, wait, cd); 1546 return cache_poll(filp, wait, cd);
1546} 1547}
1547 1548
1548static int cache_ioctl_pipefs(struct inode *inode, struct file *filp, 1549static long cache_ioctl_pipefs(struct file *filp,
1549 unsigned int cmd, unsigned long arg) 1550 unsigned int cmd, unsigned long arg)
1550{ 1551{
1552 struct inode *inode = filp->f_dentry->d_inode;
1551 struct cache_detail *cd = RPC_I(inode)->private; 1553 struct cache_detail *cd = RPC_I(inode)->private;
1554 long ret;
1552 1555
1553 return cache_ioctl(inode, filp, cmd, arg, cd); 1556 lock_kernel();
1557 ret = cache_ioctl(inode, filp, cmd, arg, cd);
1558 unlock_kernel();
1559
1560 return ret;
1554} 1561}
1555 1562
1556static int cache_open_pipefs(struct inode *inode, struct file *filp) 1563static int cache_open_pipefs(struct inode *inode, struct file *filp)
@@ -1573,7 +1580,7 @@ const struct file_operations cache_file_operations_pipefs = {
1573 .read = cache_read_pipefs, 1580 .read = cache_read_pipefs,
1574 .write = cache_write_pipefs, 1581 .write = cache_write_pipefs,
1575 .poll = cache_poll_pipefs, 1582 .poll = cache_poll_pipefs,
1576 .ioctl = cache_ioctl_pipefs, /* for FIONREAD */ 1583 .unlocked_ioctl = cache_ioctl_pipefs, /* for FIONREAD */
1577 .open = cache_open_pipefs, 1584 .open = cache_open_pipefs,
1578 .release = cache_release_pipefs, 1585 .release = cache_release_pipefs,
1579}; 1586};
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 20e30c6f8355..95ccbcf45d3e 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -27,6 +27,7 @@
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/sunrpc/rpc_pipe_fs.h> 28#include <linux/sunrpc/rpc_pipe_fs.h>
29#include <linux/sunrpc/cache.h> 29#include <linux/sunrpc/cache.h>
30#include <linux/smp_lock.h>
30 31
31static struct vfsmount *rpc_mount __read_mostly; 32static struct vfsmount *rpc_mount __read_mostly;
32static int rpc_mount_count; 33static int rpc_mount_count;
@@ -309,8 +310,7 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait)
309} 310}
310 311
311static int 312static int
312rpc_pipe_ioctl(struct inode *ino, struct file *filp, 313rpc_pipe_ioctl_unlocked(struct file *filp, unsigned int cmd, unsigned long arg)
313 unsigned int cmd, unsigned long arg)
314{ 314{
315 struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); 315 struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode);
316 int len; 316 int len;
@@ -331,13 +331,25 @@ rpc_pipe_ioctl(struct inode *ino, struct file *filp,
331 } 331 }
332} 332}
333 333
334static long
335rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
336{
337 long ret;
338
339 lock_kernel();
340 ret = rpc_pipe_ioctl_unlocked(filp, cmd, arg);
341 unlock_kernel();
342
343 return ret;
344}
345
334static const struct file_operations rpc_pipe_fops = { 346static const struct file_operations rpc_pipe_fops = {
335 .owner = THIS_MODULE, 347 .owner = THIS_MODULE,
336 .llseek = no_llseek, 348 .llseek = no_llseek,
337 .read = rpc_pipe_read, 349 .read = rpc_pipe_read,
338 .write = rpc_pipe_write, 350 .write = rpc_pipe_write,
339 .poll = rpc_pipe_poll, 351 .poll = rpc_pipe_poll,
340 .ioctl = rpc_pipe_ioctl, 352 .unlocked_ioctl = rpc_pipe_ioctl,
341 .open = rpc_pipe_open, 353 .open = rpc_pipe_open,
342 .release = rpc_pipe_release, 354 .release = rpc_pipe_release,
343}; 355};