diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-24 11:01:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-24 11:01:10 -0400 |
commit | f13771187b9423b824f32518319f6da85d819003 (patch) | |
tree | c431cf16c286065a302d5f3fb43fc1abac7e4047 /drivers/char | |
parent | 15953654cc312429740fd58fb37a5a3d63a54376 (diff) | |
parent | 9f37af654fda88a8dcca74c785f6c20e52758866 (diff) |
Merge branch 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing
* 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
uml: Pushdown the bkl from harddog_kern ioctl
sunrpc: Pushdown the bkl from sunrpc cache ioctl
sunrpc: Pushdown the bkl from ioctl
autofs4: Pushdown the bkl from ioctl
uml: Convert to unlocked_ioctls to remove implicit BKL
ncpfs: BKL ioctl pushdown
coda: Clean-up whitespace problems in pioctl.c
coda: BKL ioctl pushdown
drivers: Push down BKL into various drivers
isdn: Push down BKL into ioctl functions
scsi: Push down BKL into ioctl functions
dvb: Push down BKL into ioctl functions
smbfs: Push down BKL into ioctl function
coda/psdev: Remove BKL from ioctl function
um/mmapper: Remove BKL usage
sn_hwperf: Kill BKL usage
hfsplus: Push down BKL into ioctl function
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/apm-emulation.c | 8 | ||||
-rw-r--r-- | drivers/char/applicom.c | 13 | ||||
-rw-r--r-- | drivers/char/ds1620.c | 16 | ||||
-rw-r--r-- | drivers/char/dtlk.c | 15 | ||||
-rw-r--r-- | drivers/char/generic_nvram.c | 17 | ||||
-rw-r--r-- | drivers/char/genrtc.c | 16 | ||||
-rw-r--r-- | drivers/char/hpet.c | 14 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_devintf.c | 26 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_watchdog.c | 17 | ||||
-rw-r--r-- | drivers/char/nvram.c | 10 | ||||
-rw-r--r-- | drivers/char/nwflash.c | 7 | ||||
-rw-r--r-- | drivers/char/raw.c | 42 |
12 files changed, 144 insertions, 57 deletions
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 | */ |
268 | static int | 268 | static long |
269 | apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) | 269 | apm_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 | ||
107 | static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *); | 108 | static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *); |
108 | static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *); | 109 | static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *); |
109 | static int ac_ioctl(struct inode *, struct file *, unsigned int, | 110 | static long ac_ioctl(struct file *, unsigned int, unsigned long); |
110 | unsigned long); | ||
111 | static irqreturn_t ac_interrupt(int, void *); | 111 | static irqreturn_t ac_interrupt(int, void *); |
112 | 112 | ||
113 | static const struct file_operations ac_fops = { | 113 | static 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 | ||
121 | static struct miscdevice ac_miscdev = { | 121 | static struct miscdevice ac_miscdev = { |
@@ -689,7 +689,7 @@ static irqreturn_t ac_interrupt(int vec, void *dev_instance) | |||
689 | 689 | ||
690 | 690 | ||
691 | 691 | ||
692 | static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | 692 | static 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 | ||
234 | static int | 234 | static int |
235 | ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | 235 | ds1620_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 | ||
319 | static long | ||
320 | ds1620_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 |
320 | static int | 332 | static int |
321 | proc_therm_ds1620_read(char *buf, char **start, off_t offset, | 333 | proc_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 | ||
350 | static struct miscdevice ds1620_miscdev = { | 362 | static 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 *, | |||
93 | static unsigned int dtlk_poll(struct file *, poll_table *); | 93 | static unsigned int dtlk_poll(struct file *, poll_table *); |
94 | static int dtlk_open(struct inode *, struct file *); | 94 | static int dtlk_open(struct inode *, struct file *); |
95 | static int dtlk_release(struct inode *, struct file *); | 95 | static int dtlk_release(struct inode *, struct file *); |
96 | static int dtlk_ioctl(struct inode *inode, struct file *file, | 96 | static long dtlk_ioctl(struct file *file, |
97 | unsigned int cmd, unsigned long arg); | 97 | unsigned int cmd, unsigned long arg); |
98 | 98 | ||
99 | static const struct file_operations dtlk_fops = | 99 | static 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 | ||
266 | static int dtlk_ioctl(struct inode *inode, | 266 | static 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 | ||
87 | static int nvram_ioctl(struct inode *inode, struct file *file, | 88 | static 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 | ||
119 | static 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 | |||
119 | const struct file_operations nvram_fops = { | 130 | const 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 | ||
127 | static struct miscdevice nvram_dev = { | 138 | static 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 | ||
265 | static int gen_rtc_ioctl(struct inode *inode, struct file *file, | 265 | static 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 | ||
335 | static 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 | ||
432 | static int hpet_ioctl_common(struct hpet_dev *, int, unsigned long, int); | 432 | static int hpet_ioctl_common(struct hpet_dev *, int, unsigned long, int); |
433 | 433 | ||
434 | static int | 434 | static long hpet_ioctl(struct file *file, unsigned int cmd, |
435 | hpet_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 | ||
444 | static int hpet_ioctl_ieon(struct hpet_dev *devp) | 448 | static 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 | ||
231 | static int ipmi_ioctl(struct inode *inode, | 231 | static 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 | */ | ||
636 | static 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 | ||
827 | static const struct file_operations ipmi_fops = { | 843 | static 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 | ||
662 | static int ipmi_ioctl(struct inode *inode, struct file *file, | 662 | static 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 | ||
733 | static 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 | |||
733 | static ssize_t ipmi_write(struct file *file, | 746 | static 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 | ||
299 | static int nvram_ioctl(struct inode *inode, struct file *file, | 299 | static 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 | ||
97 | static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cmd, unsigned long arg) | 97 | static 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 | ||
637 | static struct miscdevice flash_miscdev = | 640 | static 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 | */ |
124 | static int | 124 | static long |
125 | raw_ioctl(struct inode *inode, struct file *filp, | 125 | raw_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 | ||
133 | static void bind_device(struct raw_config_request *rq) | 137 | static 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 | */ |
144 | static int raw_ctl_ioctl(struct inode *inode, struct file *filp, | 148 | static 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 | } |
242 | out: | 247 | out: |
248 | unlock_kernel(); | ||
243 | return err; | 249 | return err; |
244 | } | 250 | } |
245 | 251 | ||
246 | static const struct file_operations raw_fops = { | 252 | static 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 | ||
258 | static const struct file_operations raw_ctl_fops = { | 264 | static 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 | ||
264 | static struct cdev raw_cdev; | 270 | static struct cdev raw_cdev; |