diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 17:48:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 17:48:31 -0400 |
commit | d1794f2c5b5817eb79ccc5e00701ca748d1b073a (patch) | |
tree | 5a4c98e694e88a8c82f342d0cc9edb2a4cbbef36 /drivers/char | |
parent | a41eebab7537890409ea9dfe0fcda9b5fbdb090d (diff) | |
parent | 2fceef397f9880b212a74c418290ce69e7ac00eb (diff) |
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: (146 commits)
IB/umad: BKL is not needed for ib_umad_open()
IB/uverbs: BKL is not needed for ib_uverbs_open()
bf561-coreb: BKL unneeded for open()
Call fasync() functions without the BKL
snd/PCM: fasync BKL pushdown
ipmi: fasync BKL pushdown
ecryptfs: fasync BKL pushdown
Bluetooth VHCI: fasync BKL pushdown
tty_io: fasync BKL pushdown
tun: fasync BKL pushdown
i2o: fasync BKL pushdown
mpt: fasync BKL pushdown
Remove BKL from remote_llseek v2
Make FAT users happier by not deadlocking
x86-mce: BKL pushdown
vmwatchdog: BKL pushdown
vmcp: BKL pushdown
via-pmu: BKL pushdown
uml-random: BKL pushdown
uml-mmapper: BKL pushdown
...
Diffstat (limited to 'drivers/char')
38 files changed, 214 insertions, 75 deletions
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index e6cb1ab03e06..a96f3197e60f 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
40 | #include <linux/fs.h> | 40 | #include <linux/fs.h> |
41 | #include <linux/sched.h> | 41 | #include <linux/sched.h> |
42 | #include <linux/smp_lock.h> | ||
42 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
43 | #include <asm/pgtable.h> | 44 | #include <asm/pgtable.h> |
44 | #include "agp.h" | 45 | #include "agp.h" |
@@ -677,6 +678,7 @@ static int agp_open(struct inode *inode, struct file *file) | |||
677 | struct agp_client *client; | 678 | struct agp_client *client; |
678 | int rc = -ENXIO; | 679 | int rc = -ENXIO; |
679 | 680 | ||
681 | lock_kernel(); | ||
680 | mutex_lock(&(agp_fe.agp_mutex)); | 682 | mutex_lock(&(agp_fe.agp_mutex)); |
681 | 683 | ||
682 | if (minor != AGPGART_MINOR) | 684 | if (minor != AGPGART_MINOR) |
@@ -703,12 +705,14 @@ static int agp_open(struct inode *inode, struct file *file) | |||
703 | agp_insert_file_private(priv); | 705 | agp_insert_file_private(priv); |
704 | DBG("private=%p, client=%p", priv, client); | 706 | DBG("private=%p, client=%p", priv, client); |
705 | mutex_unlock(&(agp_fe.agp_mutex)); | 707 | mutex_unlock(&(agp_fe.agp_mutex)); |
708 | unlock_kernel(); | ||
706 | return 0; | 709 | return 0; |
707 | 710 | ||
708 | err_out_nomem: | 711 | err_out_nomem: |
709 | rc = -ENOMEM; | 712 | rc = -ENOMEM; |
710 | err_out: | 713 | err_out: |
711 | mutex_unlock(&(agp_fe.agp_mutex)); | 714 | mutex_unlock(&(agp_fe.agp_mutex)); |
715 | unlock_kernel(); | ||
712 | return rc; | 716 | return rc; |
713 | } | 717 | } |
714 | 718 | ||
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index cdd876dbb2b0..da8a1658a273 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/poll.h> | 14 | #include <linux/poll.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/smp_lock.h> | ||
16 | #include <linux/proc_fs.h> | 17 | #include <linux/proc_fs.h> |
17 | #include <linux/seq_file.h> | 18 | #include <linux/seq_file.h> |
18 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
@@ -416,6 +417,7 @@ static int apm_open(struct inode * inode, struct file * filp) | |||
416 | { | 417 | { |
417 | struct apm_user *as; | 418 | struct apm_user *as; |
418 | 419 | ||
420 | lock_kernel(); | ||
419 | as = kzalloc(sizeof(*as), GFP_KERNEL); | 421 | as = kzalloc(sizeof(*as), GFP_KERNEL); |
420 | if (as) { | 422 | if (as) { |
421 | /* | 423 | /* |
@@ -435,6 +437,7 @@ static int apm_open(struct inode * inode, struct file * filp) | |||
435 | 437 | ||
436 | filp->private_data = as; | 438 | filp->private_data = as; |
437 | } | 439 | } |
440 | unlock_kernel(); | ||
438 | 441 | ||
439 | return as ? 0 : -ENOMEM; | 442 | return as ? 0 : -ENOMEM; |
440 | } | 443 | } |
diff --git a/drivers/char/briq_panel.c b/drivers/char/briq_panel.c index b6f2639f903d..d8cff909001c 100644 --- a/drivers/char/briq_panel.c +++ b/drivers/char/briq_panel.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | ||
9 | #include <linux/types.h> | 10 | #include <linux/types.h> |
10 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
11 | #include <linux/tty.h> | 12 | #include <linux/tty.h> |
@@ -67,11 +68,15 @@ static void set_led(char state) | |||
67 | 68 | ||
68 | static int briq_panel_open(struct inode *ino, struct file *filep) | 69 | static int briq_panel_open(struct inode *ino, struct file *filep) |
69 | { | 70 | { |
70 | /* enforce single access */ | 71 | lock_kernel(); |
71 | if (vfd_is_open) | 72 | /* enforce single access, vfd_is_open is protected by BKL */ |
73 | if (vfd_is_open) { | ||
74 | unlock_kernel(); | ||
72 | return -EBUSY; | 75 | return -EBUSY; |
76 | } | ||
73 | vfd_is_open = 1; | 77 | vfd_is_open = 1; |
74 | 78 | ||
79 | unlock_kernel(); | ||
75 | return 0; | 80 | return 0; |
76 | } | 81 | } |
77 | 82 | ||
diff --git a/drivers/char/cs5535_gpio.c b/drivers/char/cs5535_gpio.c index c0a4a0bb509e..04ba906b4880 100644 --- a/drivers/char/cs5535_gpio.c +++ b/drivers/char/cs5535_gpio.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/cdev.h> | 17 | #include <linux/cdev.h> |
18 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
19 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
20 | #include <linux/smp_lock.h> | ||
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | #include <asm/io.h> | 22 | #include <asm/io.h> |
22 | 23 | ||
@@ -157,6 +158,7 @@ static int cs5535_gpio_open(struct inode *inode, struct file *file) | |||
157 | { | 158 | { |
158 | u32 m = iminor(inode); | 159 | u32 m = iminor(inode); |
159 | 160 | ||
161 | cycle_kernel_lock(); | ||
160 | /* the mask says which pins are usable by this driver */ | 162 | /* the mask says which pins are usable by this driver */ |
161 | if ((mask & (1 << m)) == 0) | 163 | if ((mask & (1 << m)) == 0) |
162 | return -EINVAL; | 164 | return -EINVAL; |
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c index ea35ab2c9909..fb584938c9c3 100644 --- a/drivers/char/ds1286.c +++ b/drivers/char/ds1286.c | |||
@@ -27,6 +27,7 @@ | |||
27 | * option) any later version. | 27 | * option) any later version. |
28 | */ | 28 | */ |
29 | #include <linux/ds1286.h> | 29 | #include <linux/ds1286.h> |
30 | #include <linux/smp_lock.h> | ||
30 | #include <linux/types.h> | 31 | #include <linux/types.h> |
31 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
32 | #include <linux/miscdevice.h> | 33 | #include <linux/miscdevice.h> |
@@ -252,6 +253,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, | |||
252 | 253 | ||
253 | static int ds1286_open(struct inode *inode, struct file *file) | 254 | static int ds1286_open(struct inode *inode, struct file *file) |
254 | { | 255 | { |
256 | lock_kernel(); | ||
255 | spin_lock_irq(&ds1286_lock); | 257 | spin_lock_irq(&ds1286_lock); |
256 | 258 | ||
257 | if (ds1286_status & RTC_IS_OPEN) | 259 | if (ds1286_status & RTC_IS_OPEN) |
@@ -260,10 +262,12 @@ static int ds1286_open(struct inode *inode, struct file *file) | |||
260 | ds1286_status |= RTC_IS_OPEN; | 262 | ds1286_status |= RTC_IS_OPEN; |
261 | 263 | ||
262 | spin_unlock_irq(&ds1286_lock); | 264 | spin_unlock_irq(&ds1286_lock); |
265 | unlock_kernel(); | ||
263 | return 0; | 266 | return 0; |
264 | 267 | ||
265 | out_busy: | 268 | out_busy: |
266 | spin_lock_irq(&ds1286_lock); | 269 | spin_lock_irq(&ds1286_lock); |
270 | unlock_kernel(); | ||
267 | return -EBUSY; | 271 | return -EBUSY; |
268 | } | 272 | } |
269 | 273 | ||
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c index 334ad5bbe6b6..34275c6f1da2 100644 --- a/drivers/char/ds1620.c +++ b/drivers/char/ds1620.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/proc_fs.h> | 8 | #include <linux/proc_fs.h> |
9 | #include <linux/capability.h> | 9 | #include <linux/capability.h> |
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/smp_lock.h> | ||
11 | 12 | ||
12 | #include <asm/hardware.h> | 13 | #include <asm/hardware.h> |
13 | #include <asm/mach-types.h> | 14 | #include <asm/mach-types.h> |
@@ -208,6 +209,12 @@ static void ds1620_read_state(struct therm *therm) | |||
208 | therm->hi = cvt_9_to_int(ds1620_in(THERM_READ_TH, 9)); | 209 | therm->hi = cvt_9_to_int(ds1620_in(THERM_READ_TH, 9)); |
209 | } | 210 | } |
210 | 211 | ||
212 | static int ds1620_open(struct inode *inode, struct file *file) | ||
213 | { | ||
214 | cycle_kernel_lock(); | ||
215 | return nonseekable_open(inode, file); | ||
216 | } | ||
217 | |||
211 | static ssize_t | 218 | static ssize_t |
212 | ds1620_read(struct file *file, char __user *buf, size_t count, loff_t *ptr) | 219 | ds1620_read(struct file *file, char __user *buf, size_t count, loff_t *ptr) |
213 | { | 220 | { |
@@ -336,7 +343,7 @@ static struct proc_dir_entry *proc_therm_ds1620; | |||
336 | 343 | ||
337 | static const struct file_operations ds1620_fops = { | 344 | static const struct file_operations ds1620_fops = { |
338 | .owner = THIS_MODULE, | 345 | .owner = THIS_MODULE, |
339 | .open = nonseekable_open, | 346 | .open = ds1620_open, |
340 | .read = ds1620_read, | 347 | .read = ds1620_read, |
341 | .ioctl = ds1620_ioctl, | 348 | .ioctl = ds1620_ioctl, |
342 | }; | 349 | }; |
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index a69c65283260..7bf7485377e6 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/device.h> | 35 | #include <linux/device.h> |
36 | #include <linux/smp_lock.h> | ||
36 | 37 | ||
37 | #include <asm/atarihw.h> | 38 | #include <asm/atarihw.h> |
38 | #include <asm/traps.h> | 39 | #include <asm/traps.h> |
@@ -436,13 +437,17 @@ static unsigned int dsp56k_poll(struct file *file, poll_table *wait) | |||
436 | static int dsp56k_open(struct inode *inode, struct file *file) | 437 | static int dsp56k_open(struct inode *inode, struct file *file) |
437 | { | 438 | { |
438 | int dev = iminor(inode) & 0x0f; | 439 | int dev = iminor(inode) & 0x0f; |
440 | int ret = 0; | ||
439 | 441 | ||
442 | lock_kernel(); | ||
440 | switch(dev) | 443 | switch(dev) |
441 | { | 444 | { |
442 | case DSP56K_DEV_56001: | 445 | case DSP56K_DEV_56001: |
443 | 446 | ||
444 | if (test_and_set_bit(0, &dsp56k.in_use)) | 447 | if (test_and_set_bit(0, &dsp56k.in_use)) { |
445 | return -EBUSY; | 448 | ret = -EBUSY; |
449 | goto out; | ||
450 | } | ||
446 | 451 | ||
447 | dsp56k.timeout = TIMEOUT; | 452 | dsp56k.timeout = TIMEOUT; |
448 | dsp56k.maxio = MAXIO; | 453 | dsp56k.maxio = MAXIO; |
@@ -458,10 +463,11 @@ static int dsp56k_open(struct inode *inode, struct file *file) | |||
458 | break; | 463 | break; |
459 | 464 | ||
460 | default: | 465 | default: |
461 | return -ENODEV; | 466 | ret = -ENODEV; |
462 | } | 467 | } |
463 | 468 | out: | |
464 | return 0; | 469 | unlock_kernel(); |
470 | return ret; | ||
465 | } | 471 | } |
466 | 472 | ||
467 | static int dsp56k_release(struct inode *inode, struct file *file) | 473 | static int dsp56k_release(struct inode *inode, struct file *file) |
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index abde6ddefe69..6b900b297cc6 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/errno.h> /* for -EBUSY */ | 56 | #include <linux/errno.h> /* for -EBUSY */ |
57 | #include <linux/ioport.h> /* for request_region */ | 57 | #include <linux/ioport.h> /* for request_region */ |
58 | #include <linux/delay.h> /* for loops_per_jiffy */ | 58 | #include <linux/delay.h> /* for loops_per_jiffy */ |
59 | #include <linux/smp_lock.h> /* cycle_kernel_lock() */ | ||
59 | #include <asm/io.h> /* for inb_p, outb_p, inb, outb, etc. */ | 60 | #include <asm/io.h> /* for inb_p, outb_p, inb, outb, etc. */ |
60 | #include <asm/uaccess.h> /* for get_user, etc. */ | 61 | #include <asm/uaccess.h> /* for get_user, etc. */ |
61 | #include <linux/wait.h> /* for wait_queue */ | 62 | #include <linux/wait.h> /* for wait_queue */ |
@@ -288,10 +289,12 @@ static int dtlk_ioctl(struct inode *inode, | |||
288 | } | 289 | } |
289 | } | 290 | } |
290 | 291 | ||
292 | /* Note that nobody ever sets dtlk_busy... */ | ||
291 | static int dtlk_open(struct inode *inode, struct file *file) | 293 | static int dtlk_open(struct inode *inode, struct file *file) |
292 | { | 294 | { |
293 | TRACE_TEXT("(dtlk_open"); | 295 | TRACE_TEXT("(dtlk_open"); |
294 | 296 | ||
297 | cycle_kernel_lock(); | ||
295 | nonseekable_open(inode, file); | 298 | nonseekable_open(inode, file); |
296 | switch (iminor(inode)) { | 299 | switch (iminor(inode)) { |
297 | case DTLK_MINOR: | 300 | case DTLK_MINOR: |
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c index 49233f589874..d57ca3e4e534 100644 --- a/drivers/char/efirtc.c +++ b/drivers/char/efirtc.c | |||
@@ -28,6 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | 30 | ||
31 | #include <linux/smp_lock.h> | ||
31 | #include <linux/types.h> | 32 | #include <linux/types.h> |
32 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
33 | #include <linux/miscdevice.h> | 34 | #include <linux/miscdevice.h> |
@@ -272,6 +273,7 @@ efi_rtc_open(struct inode *inode, struct file *file) | |||
272 | * We do accept multiple open files at the same time as we | 273 | * We do accept multiple open files at the same time as we |
273 | * synchronize on the per call operation. | 274 | * synchronize on the per call operation. |
274 | */ | 275 | */ |
276 | cycle_kernel_lock(); | ||
275 | return 0; | 277 | return 0; |
276 | } | 278 | } |
277 | 279 | ||
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c index 69f0a2993af0..aac0985a572b 100644 --- a/drivers/char/genrtc.c +++ b/drivers/char/genrtc.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/init.h> | 51 | #include <linux/init.h> |
52 | #include <linux/poll.h> | 52 | #include <linux/poll.h> |
53 | #include <linux/proc_fs.h> | 53 | #include <linux/proc_fs.h> |
54 | #include <linux/smp_lock.h> | ||
54 | #include <linux/workqueue.h> | 55 | #include <linux/workqueue.h> |
55 | 56 | ||
56 | #include <asm/uaccess.h> | 57 | #include <asm/uaccess.h> |
@@ -338,12 +339,16 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file, | |||
338 | 339 | ||
339 | static int gen_rtc_open(struct inode *inode, struct file *file) | 340 | static int gen_rtc_open(struct inode *inode, struct file *file) |
340 | { | 341 | { |
341 | if (gen_rtc_status & RTC_IS_OPEN) | 342 | lock_kernel(); |
343 | if (gen_rtc_status & RTC_IS_OPEN) { | ||
344 | unlock_kernel(); | ||
342 | return -EBUSY; | 345 | return -EBUSY; |
346 | } | ||
343 | 347 | ||
344 | gen_rtc_status |= RTC_IS_OPEN; | 348 | gen_rtc_status |= RTC_IS_OPEN; |
345 | gen_rtc_irq_data = 0; | 349 | gen_rtc_irq_data = 0; |
346 | irq_active = 0; | 350 | irq_active = 0; |
351 | unlock_kernel(); | ||
347 | 352 | ||
348 | return 0; | 353 | return 0; |
349 | } | 354 | } |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index e7fb0bca3667..fb0a85a1eb36 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/smp_lock.h> | ||
17 | #include <linux/types.h> | 18 | #include <linux/types.h> |
18 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
19 | #include <linux/major.h> | 20 | #include <linux/major.h> |
@@ -193,6 +194,7 @@ static int hpet_open(struct inode *inode, struct file *file) | |||
193 | if (file->f_mode & FMODE_WRITE) | 194 | if (file->f_mode & FMODE_WRITE) |
194 | return -EINVAL; | 195 | return -EINVAL; |
195 | 196 | ||
197 | lock_kernel(); | ||
196 | spin_lock_irq(&hpet_lock); | 198 | spin_lock_irq(&hpet_lock); |
197 | 199 | ||
198 | for (devp = NULL, hpetp = hpets; hpetp && !devp; hpetp = hpetp->hp_next) | 200 | for (devp = NULL, hpetp = hpets; hpetp && !devp; hpetp = hpetp->hp_next) |
@@ -207,6 +209,7 @@ static int hpet_open(struct inode *inode, struct file *file) | |||
207 | 209 | ||
208 | if (!devp) { | 210 | if (!devp) { |
209 | spin_unlock_irq(&hpet_lock); | 211 | spin_unlock_irq(&hpet_lock); |
212 | unlock_kernel(); | ||
210 | return -EBUSY; | 213 | return -EBUSY; |
211 | } | 214 | } |
212 | 215 | ||
@@ -214,6 +217,7 @@ static int hpet_open(struct inode *inode, struct file *file) | |||
214 | devp->hd_irqdata = 0; | 217 | devp->hd_irqdata = 0; |
215 | devp->hd_flags |= HPET_OPEN; | 218 | devp->hd_flags |= HPET_OPEN; |
216 | spin_unlock_irq(&hpet_lock); | 219 | spin_unlock_irq(&hpet_lock); |
220 | unlock_kernel(); | ||
217 | 221 | ||
218 | return 0; | 222 | return 0; |
219 | } | 223 | } |
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 662d60e44e9a..e5d583c84e4f 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/kernel.h> | 37 | #include <linux/kernel.h> |
38 | #include <linux/fs.h> | 38 | #include <linux/fs.h> |
39 | #include <linux/sched.h> | 39 | #include <linux/sched.h> |
40 | #include <linux/smp_lock.h> | ||
40 | #include <linux/init.h> | 41 | #include <linux/init.h> |
41 | #include <linux/miscdevice.h> | 42 | #include <linux/miscdevice.h> |
42 | #include <linux/delay.h> | 43 | #include <linux/delay.h> |
@@ -86,6 +87,7 @@ static int rng_dev_open(struct inode *inode, struct file *filp) | |||
86 | return -EINVAL; | 87 | return -EINVAL; |
87 | if (filp->f_mode & FMODE_WRITE) | 88 | if (filp->f_mode & FMODE_WRITE) |
88 | return -EINVAL; | 89 | return -EINVAL; |
90 | cycle_kernel_lock(); | ||
89 | return 0; | 91 | return 0; |
90 | } | 92 | } |
91 | 93 | ||
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index c12cf8fc4be0..61b6fe4156bb 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -98,6 +98,7 @@ | |||
98 | #include <linux/major.h> | 98 | #include <linux/major.h> |
99 | #include <linux/wait.h> | 99 | #include <linux/wait.h> |
100 | #include <linux/device.h> | 100 | #include <linux/device.h> |
101 | #include <linux/smp_lock.h> | ||
101 | 102 | ||
102 | #include <linux/tty.h> | 103 | #include <linux/tty.h> |
103 | #include <linux/tty_flip.h> | 104 | #include <linux/tty_flip.h> |
@@ -2908,42 +2909,11 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg ) | |||
2908 | static int | 2909 | static int |
2909 | ip2_ipl_open( struct inode *pInode, struct file *pFile ) | 2910 | ip2_ipl_open( struct inode *pInode, struct file *pFile ) |
2910 | { | 2911 | { |
2911 | unsigned int iplminor = iminor(pInode); | ||
2912 | i2eBordStrPtr pB; | ||
2913 | i2ChanStrPtr pCh; | ||
2914 | 2912 | ||
2915 | #ifdef IP2DEBUG_IPL | 2913 | #ifdef IP2DEBUG_IPL |
2916 | printk (KERN_DEBUG "IP2IPL: open\n" ); | 2914 | printk (KERN_DEBUG "IP2IPL: open\n" ); |
2917 | #endif | 2915 | #endif |
2918 | 2916 | cycle_kernel_lock(); | |
2919 | switch(iplminor) { | ||
2920 | // These are the IPL devices | ||
2921 | case 0: | ||
2922 | case 4: | ||
2923 | case 8: | ||
2924 | case 12: | ||
2925 | break; | ||
2926 | |||
2927 | // These are the status devices | ||
2928 | case 1: | ||
2929 | case 5: | ||
2930 | case 9: | ||
2931 | case 13: | ||
2932 | break; | ||
2933 | |||
2934 | // These are the debug devices | ||
2935 | case 2: | ||
2936 | case 6: | ||
2937 | case 10: | ||
2938 | case 14: | ||
2939 | pB = i2BoardPtrTable[iplminor / 4]; | ||
2940 | pCh = (i2ChanStrPtr) pB->i2eChannelPtr; | ||
2941 | break; | ||
2942 | |||
2943 | // This is the trace device | ||
2944 | case 3: | ||
2945 | break; | ||
2946 | } | ||
2947 | return 0; | 2917 | return 0; |
2948 | } | 2918 | } |
2949 | 2919 | ||
diff --git a/drivers/char/ip27-rtc.c b/drivers/char/ip27-rtc.c index 86e6538a77b0..ec9d0443d92c 100644 --- a/drivers/char/ip27-rtc.c +++ b/drivers/char/ip27-rtc.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/bcd.h> | 27 | #include <linux/bcd.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <linux/smp_lock.h> | ||
30 | #include <linux/types.h> | 31 | #include <linux/types.h> |
31 | #include <linux/miscdevice.h> | 32 | #include <linux/miscdevice.h> |
32 | #include <linux/ioport.h> | 33 | #include <linux/ioport.h> |
@@ -163,15 +164,18 @@ static long rtc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
163 | 164 | ||
164 | static int rtc_open(struct inode *inode, struct file *file) | 165 | static int rtc_open(struct inode *inode, struct file *file) |
165 | { | 166 | { |
167 | lock_kernel(); | ||
166 | spin_lock_irq(&rtc_lock); | 168 | spin_lock_irq(&rtc_lock); |
167 | 169 | ||
168 | if (rtc_status & RTC_IS_OPEN) { | 170 | if (rtc_status & RTC_IS_OPEN) { |
169 | spin_unlock_irq(&rtc_lock); | 171 | spin_unlock_irq(&rtc_lock); |
172 | unlock_kernel(); | ||
170 | return -EBUSY; | 173 | return -EBUSY; |
171 | } | 174 | } |
172 | 175 | ||
173 | rtc_status |= RTC_IS_OPEN; | 176 | rtc_status |= RTC_IS_OPEN; |
174 | spin_unlock_irq(&rtc_lock); | 177 | spin_unlock_irq(&rtc_lock); |
178 | unlock_kernel(); | ||
175 | 179 | ||
176 | return 0; | 180 | return 0; |
177 | } | 181 | } |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index 0246a2b8ce48..c11a40483459 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/init.h> | 43 | #include <linux/init.h> |
44 | #include <linux/device.h> | 44 | #include <linux/device.h> |
45 | #include <linux/compat.h> | 45 | #include <linux/compat.h> |
46 | #include <linux/smp_lock.h> | ||
46 | 47 | ||
47 | struct ipmi_file_private | 48 | struct ipmi_file_private |
48 | { | 49 | { |
@@ -100,7 +101,9 @@ static int ipmi_fasync(int fd, struct file *file, int on) | |||
100 | struct ipmi_file_private *priv = file->private_data; | 101 | struct ipmi_file_private *priv = file->private_data; |
101 | int result; | 102 | int result; |
102 | 103 | ||
104 | lock_kernel(); /* could race against open() otherwise */ | ||
103 | result = fasync_helper(fd, file, on, &priv->fasync_queue); | 105 | result = fasync_helper(fd, file, on, &priv->fasync_queue); |
106 | unlock_kernel(); | ||
104 | 107 | ||
105 | return (result); | 108 | return (result); |
106 | } | 109 | } |
@@ -121,6 +124,7 @@ static int ipmi_open(struct inode *inode, struct file *file) | |||
121 | if (!priv) | 124 | if (!priv) |
122 | return -ENOMEM; | 125 | return -ENOMEM; |
123 | 126 | ||
127 | lock_kernel(); | ||
124 | priv->file = file; | 128 | priv->file = file; |
125 | 129 | ||
126 | rv = ipmi_create_user(if_num, | 130 | rv = ipmi_create_user(if_num, |
@@ -129,7 +133,7 @@ static int ipmi_open(struct inode *inode, struct file *file) | |||
129 | &(priv->user)); | 133 | &(priv->user)); |
130 | if (rv) { | 134 | if (rv) { |
131 | kfree(priv); | 135 | kfree(priv); |
132 | return rv; | 136 | goto out; |
133 | } | 137 | } |
134 | 138 | ||
135 | file->private_data = priv; | 139 | file->private_data = priv; |
@@ -144,7 +148,9 @@ static int ipmi_open(struct inode *inode, struct file *file) | |||
144 | priv->default_retries = -1; | 148 | priv->default_retries = -1; |
145 | priv->default_retry_time_ms = 0; | 149 | priv->default_retry_time_ms = 0; |
146 | 150 | ||
147 | return 0; | 151 | out: |
152 | unlock_kernel(); | ||
153 | return rv; | ||
148 | } | 154 | } |
149 | 155 | ||
150 | static int ipmi_release(struct inode *inode, struct file *file) | 156 | static int ipmi_release(struct inode *inode, struct file *file) |
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 0e6df289cb46..235fab0bdf79 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <linux/ipmi.h> | 36 | #include <linux/ipmi.h> |
37 | #include <linux/ipmi_smi.h> | 37 | #include <linux/ipmi_smi.h> |
38 | #include <linux/smp_lock.h> | ||
38 | #include <linux/watchdog.h> | 39 | #include <linux/watchdog.h> |
39 | #include <linux/miscdevice.h> | 40 | #include <linux/miscdevice.h> |
40 | #include <linux/init.h> | 41 | #include <linux/init.h> |
@@ -818,6 +819,8 @@ static int ipmi_open(struct inode *ino, struct file *filep) | |||
818 | if (test_and_set_bit(0, &ipmi_wdog_open)) | 819 | if (test_and_set_bit(0, &ipmi_wdog_open)) |
819 | return -EBUSY; | 820 | return -EBUSY; |
820 | 821 | ||
822 | cycle_kernel_lock(); | ||
823 | |||
821 | /* | 824 | /* |
822 | * Don't start the timer now, let it start on the | 825 | * Don't start the timer now, let it start on the |
823 | * first heartbeat. | 826 | * first heartbeat. |
diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c index 4fe9206f84de..1c29b20e4f4c 100644 --- a/drivers/char/lcd.c +++ b/drivers/char/lcd.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/mc146818rtc.h> | 20 | #include <linux/mc146818rtc.h> |
21 | #include <linux/netdevice.h> | 21 | #include <linux/netdevice.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/smp_lock.h> | ||
23 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
24 | 25 | ||
25 | #include <asm/io.h> | 26 | #include <asm/io.h> |
@@ -414,6 +415,8 @@ static int lcd_ioctl(struct inode *inode, struct file *file, | |||
414 | 415 | ||
415 | static int lcd_open(struct inode *inode, struct file *file) | 416 | static int lcd_open(struct inode *inode, struct file *file) |
416 | { | 417 | { |
418 | cycle_kernel_lock(); | ||
419 | |||
417 | if (!lcd_present) | 420 | if (!lcd_present) |
418 | return -ENXIO; | 421 | return -ENXIO; |
419 | else | 422 | else |
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 60ac642752be..71abb4c33aa2 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -126,6 +126,7 @@ | |||
126 | #include <linux/device.h> | 126 | #include <linux/device.h> |
127 | #include <linux/wait.h> | 127 | #include <linux/wait.h> |
128 | #include <linux/jiffies.h> | 128 | #include <linux/jiffies.h> |
129 | #include <linux/smp_lock.h> | ||
129 | 130 | ||
130 | #include <linux/parport.h> | 131 | #include <linux/parport.h> |
131 | #undef LP_STATS | 132 | #undef LP_STATS |
@@ -489,14 +490,21 @@ static ssize_t lp_read(struct file * file, char __user * buf, | |||
489 | static int lp_open(struct inode * inode, struct file * file) | 490 | static int lp_open(struct inode * inode, struct file * file) |
490 | { | 491 | { |
491 | unsigned int minor = iminor(inode); | 492 | unsigned int minor = iminor(inode); |
493 | int ret = 0; | ||
492 | 494 | ||
493 | if (minor >= LP_NO) | 495 | lock_kernel(); |
494 | return -ENXIO; | 496 | if (minor >= LP_NO) { |
495 | if ((LP_F(minor) & LP_EXIST) == 0) | 497 | ret = -ENXIO; |
496 | return -ENXIO; | 498 | goto out; |
497 | if (test_and_set_bit(LP_BUSY_BIT_POS, &LP_F(minor))) | 499 | } |
498 | return -EBUSY; | 500 | if ((LP_F(minor) & LP_EXIST) == 0) { |
499 | 501 | ret = -ENXIO; | |
502 | goto out; | ||
503 | } | ||
504 | if (test_and_set_bit(LP_BUSY_BIT_POS, &LP_F(minor))) { | ||
505 | ret = -EBUSY; | ||
506 | goto out; | ||
507 | } | ||
500 | /* If ABORTOPEN is set and the printer is offline or out of paper, | 508 | /* If ABORTOPEN is set and the printer is offline or out of paper, |
501 | we may still want to open it to perform ioctl()s. Therefore we | 509 | we may still want to open it to perform ioctl()s. Therefore we |
502 | have commandeered O_NONBLOCK, even though it is being used in | 510 | have commandeered O_NONBLOCK, even though it is being used in |
@@ -510,21 +518,25 @@ static int lp_open(struct inode * inode, struct file * file) | |||
510 | if (status & LP_POUTPA) { | 518 | if (status & LP_POUTPA) { |
511 | printk(KERN_INFO "lp%d out of paper\n", minor); | 519 | printk(KERN_INFO "lp%d out of paper\n", minor); |
512 | LP_F(minor) &= ~LP_BUSY; | 520 | LP_F(minor) &= ~LP_BUSY; |
513 | return -ENOSPC; | 521 | ret = -ENOSPC; |
522 | goto out; | ||
514 | } else if (!(status & LP_PSELECD)) { | 523 | } else if (!(status & LP_PSELECD)) { |
515 | printk(KERN_INFO "lp%d off-line\n", minor); | 524 | printk(KERN_INFO "lp%d off-line\n", minor); |
516 | LP_F(minor) &= ~LP_BUSY; | 525 | LP_F(minor) &= ~LP_BUSY; |
517 | return -EIO; | 526 | ret = -EIO; |
527 | goto out; | ||
518 | } else if (!(status & LP_PERRORP)) { | 528 | } else if (!(status & LP_PERRORP)) { |
519 | printk(KERN_ERR "lp%d printer error\n", minor); | 529 | printk(KERN_ERR "lp%d printer error\n", minor); |
520 | LP_F(minor) &= ~LP_BUSY; | 530 | LP_F(minor) &= ~LP_BUSY; |
521 | return -EIO; | 531 | ret = -EIO; |
532 | goto out; | ||
522 | } | 533 | } |
523 | } | 534 | } |
524 | lp_table[minor].lp_buffer = kmalloc(LP_BUFFER_SIZE, GFP_KERNEL); | 535 | lp_table[minor].lp_buffer = kmalloc(LP_BUFFER_SIZE, GFP_KERNEL); |
525 | if (!lp_table[minor].lp_buffer) { | 536 | if (!lp_table[minor].lp_buffer) { |
526 | LP_F(minor) &= ~LP_BUSY; | 537 | LP_F(minor) &= ~LP_BUSY; |
527 | return -ENOMEM; | 538 | ret = -ENOMEM; |
539 | goto out; | ||
528 | } | 540 | } |
529 | /* Determine if the peripheral supports ECP mode */ | 541 | /* Determine if the peripheral supports ECP mode */ |
530 | lp_claim_parport_or_block (&lp_table[minor]); | 542 | lp_claim_parport_or_block (&lp_table[minor]); |
@@ -540,7 +552,9 @@ static int lp_open(struct inode * inode, struct file * file) | |||
540 | parport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT); | 552 | parport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT); |
541 | lp_release_parport (&lp_table[minor]); | 553 | lp_release_parport (&lp_table[minor]); |
542 | lp_table[minor].current_mode = IEEE1284_MODE_COMPAT; | 554 | lp_table[minor].current_mode = IEEE1284_MODE_COMPAT; |
543 | return 0; | 555 | out: |
556 | unlock_kernel(); | ||
557 | return ret; | ||
544 | } | 558 | } |
545 | 559 | ||
546 | static int lp_release(struct inode * inode, struct file * file) | 560 | static int lp_release(struct inode * inode, struct file * file) |
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index f4716ad7348a..acd8e9ed474a 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
25 | #include <linux/uio.h> | 25 | #include <linux/uio.h> |
26 | #include <linux/mutex.h> | 26 | #include <linux/mutex.h> |
27 | #include <linux/smp_lock.h> | ||
27 | #include <asm/io.h> | 28 | #include <asm/io.h> |
28 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
29 | #include <asm/system.h> | 30 | #include <asm/system.h> |
@@ -382,15 +383,19 @@ static int mbcs_open(struct inode *ip, struct file *fp) | |||
382 | struct mbcs_soft *soft; | 383 | struct mbcs_soft *soft; |
383 | int minor; | 384 | int minor; |
384 | 385 | ||
386 | lock_kernel(); | ||
385 | minor = iminor(ip); | 387 | minor = iminor(ip); |
386 | 388 | ||
389 | /* Nothing protects access to this list... */ | ||
387 | list_for_each_entry(soft, &soft_list, list) { | 390 | list_for_each_entry(soft, &soft_list, list) { |
388 | if (soft->nasid == minor) { | 391 | if (soft->nasid == minor) { |
389 | fp->private_data = soft->cxdev; | 392 | fp->private_data = soft->cxdev; |
393 | unlock_kernel(); | ||
390 | return 0; | 394 | return 0; |
391 | } | 395 | } |
392 | } | 396 | } |
393 | 397 | ||
398 | unlock_kernel(); | ||
394 | return -ENODEV; | 399 | return -ENODEV; |
395 | } | 400 | } |
396 | 401 | ||
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 934ffafedaea..070e22e8ea9e 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/bootmem.h> | 26 | #include <linux/bootmem.h> |
27 | #include <linux/splice.h> | 27 | #include <linux/splice.h> |
28 | #include <linux/pfn.h> | 28 | #include <linux/pfn.h> |
29 | #include <linux/smp_lock.h> | ||
29 | 30 | ||
30 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
31 | #include <asm/io.h> | 32 | #include <asm/io.h> |
@@ -889,6 +890,9 @@ static const struct file_operations kmsg_fops = { | |||
889 | 890 | ||
890 | static int memory_open(struct inode * inode, struct file * filp) | 891 | static int memory_open(struct inode * inode, struct file * filp) |
891 | { | 892 | { |
893 | int ret = 0; | ||
894 | |||
895 | lock_kernel(); | ||
892 | switch (iminor(inode)) { | 896 | switch (iminor(inode)) { |
893 | case 1: | 897 | case 1: |
894 | filp->f_op = &mem_fops; | 898 | filp->f_op = &mem_fops; |
@@ -932,11 +936,13 @@ static int memory_open(struct inode * inode, struct file * filp) | |||
932 | break; | 936 | break; |
933 | #endif | 937 | #endif |
934 | default: | 938 | default: |
939 | unlock_kernel(); | ||
935 | return -ENXIO; | 940 | return -ENXIO; |
936 | } | 941 | } |
937 | if (filp->f_op && filp->f_op->open) | 942 | if (filp->f_op && filp->f_op->open) |
938 | return filp->f_op->open(inode,filp); | 943 | ret = filp->f_op->open(inode,filp); |
939 | return 0; | 944 | unlock_kernel(); |
945 | return ret; | ||
940 | } | 946 | } |
941 | 947 | ||
942 | static const struct file_operations memory_fops = { | 948 | static const struct file_operations memory_fops = { |
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index eaace0db0ff4..6e1563c3d30a 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/device.h> | 49 | #include <linux/device.h> |
50 | #include <linux/tty.h> | 50 | #include <linux/tty.h> |
51 | #include <linux/kmod.h> | 51 | #include <linux/kmod.h> |
52 | #include <linux/smp_lock.h> | ||
52 | 53 | ||
53 | /* | 54 | /* |
54 | * Head entry for the doubly linked miscdevice list | 55 | * Head entry for the doubly linked miscdevice list |
@@ -118,6 +119,7 @@ static int misc_open(struct inode * inode, struct file * file) | |||
118 | int err = -ENODEV; | 119 | int err = -ENODEV; |
119 | const struct file_operations *old_fops, *new_fops = NULL; | 120 | const struct file_operations *old_fops, *new_fops = NULL; |
120 | 121 | ||
122 | lock_kernel(); | ||
121 | mutex_lock(&misc_mtx); | 123 | mutex_lock(&misc_mtx); |
122 | 124 | ||
123 | list_for_each_entry(c, &misc_list, list) { | 125 | list_for_each_entry(c, &misc_list, list) { |
@@ -155,6 +157,7 @@ static int misc_open(struct inode * inode, struct file * file) | |||
155 | fops_put(old_fops); | 157 | fops_put(old_fops); |
156 | fail: | 158 | fail: |
157 | mutex_unlock(&misc_mtx); | 159 | mutex_unlock(&misc_mtx); |
160 | unlock_kernel(); | ||
158 | return err; | 161 | return err; |
159 | } | 162 | } |
160 | 163 | ||
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index 8d14823b0514..50243fcd87e8 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/serial.h> | 56 | #include <linux/serial.h> |
57 | #include <linux/sched.h> | 57 | #include <linux/sched.h> |
58 | #include <linux/spinlock.h> | 58 | #include <linux/spinlock.h> |
59 | #include <linux/smp_lock.h> | ||
59 | #include <linux/delay.h> | 60 | #include <linux/delay.h> |
60 | #include <linux/serial_8250.h> | 61 | #include <linux/serial_8250.h> |
61 | #include "smapi.h" | 62 | #include "smapi.h" |
@@ -100,6 +101,7 @@ static int mwave_open(struct inode *inode, struct file *file) | |||
100 | PRINTK_2(TRACE_MWAVE, | 101 | PRINTK_2(TRACE_MWAVE, |
101 | "mwavedd::mwave_open, exit return retval %x\n", retval); | 102 | "mwavedd::mwave_open, exit return retval %x\n", retval); |
102 | 103 | ||
104 | cycle_kernel_lock(); | ||
103 | return retval; | 105 | return retval; |
104 | } | 106 | } |
105 | 107 | ||
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 98dec380af49..197cd7a0c332 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c | |||
@@ -107,6 +107,7 @@ | |||
107 | #include <linux/init.h> | 107 | #include <linux/init.h> |
108 | #include <linux/proc_fs.h> | 108 | #include <linux/proc_fs.h> |
109 | #include <linux/spinlock.h> | 109 | #include <linux/spinlock.h> |
110 | #include <linux/smp_lock.h> | ||
110 | 111 | ||
111 | #include <asm/io.h> | 112 | #include <asm/io.h> |
112 | #include <asm/uaccess.h> | 113 | #include <asm/uaccess.h> |
@@ -333,12 +334,14 @@ nvram_ioctl(struct inode *inode, struct file *file, | |||
333 | static int | 334 | static int |
334 | nvram_open(struct inode *inode, struct file *file) | 335 | nvram_open(struct inode *inode, struct file *file) |
335 | { | 336 | { |
337 | lock_kernel(); | ||
336 | spin_lock(&nvram_state_lock); | 338 | spin_lock(&nvram_state_lock); |
337 | 339 | ||
338 | if ((nvram_open_cnt && (file->f_flags & O_EXCL)) || | 340 | if ((nvram_open_cnt && (file->f_flags & O_EXCL)) || |
339 | (nvram_open_mode & NVRAM_EXCL) || | 341 | (nvram_open_mode & NVRAM_EXCL) || |
340 | ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) { | 342 | ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) { |
341 | spin_unlock(&nvram_state_lock); | 343 | spin_unlock(&nvram_state_lock); |
344 | unlock_kernel(); | ||
342 | return -EBUSY; | 345 | return -EBUSY; |
343 | } | 346 | } |
344 | 347 | ||
@@ -349,6 +352,7 @@ nvram_open(struct inode *inode, struct file *file) | |||
349 | nvram_open_cnt++; | 352 | nvram_open_cnt++; |
350 | 353 | ||
351 | spin_unlock(&nvram_state_lock); | 354 | spin_unlock(&nvram_state_lock); |
355 | unlock_kernel(); | ||
352 | 356 | ||
353 | return 0; | 357 | return 0; |
354 | } | 358 | } |
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c index ecfaf180e5bd..b930de50407a 100644 --- a/drivers/char/pc8736x_gpio.c +++ b/drivers/char/pc8736x_gpio.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
21 | #include <linux/nsc_gpio.h> | 21 | #include <linux/nsc_gpio.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/smp_lock.h> | ||
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | 25 | ||
25 | #define DEVNAME "pc8736x_gpio" | 26 | #define DEVNAME "pc8736x_gpio" |
@@ -217,6 +218,7 @@ static int pc8736x_gpio_open(struct inode *inode, struct file *file) | |||
217 | unsigned m = iminor(inode); | 218 | unsigned m = iminor(inode); |
218 | file->private_data = &pc8736x_gpio_ops; | 219 | file->private_data = &pc8736x_gpio_ops; |
219 | 220 | ||
221 | cycle_kernel_lock(); | ||
220 | dev_dbg(&pdev->dev, "open %d\n", m); | 222 | dev_dbg(&pdev->dev, "open %d\n", m); |
221 | 223 | ||
222 | if (m >= PC8736X_GPIO_CT) | 224 | if (m >= PC8736X_GPIO_CT) |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 3aab837d9480..f6e6acadd9a0 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <linux/poll.h> | 66 | #include <linux/poll.h> |
67 | #include <linux/major.h> | 67 | #include <linux/major.h> |
68 | #include <linux/ppdev.h> | 68 | #include <linux/ppdev.h> |
69 | #include <linux/smp_lock.h> | ||
69 | #include <asm/uaccess.h> | 70 | #include <asm/uaccess.h> |
70 | 71 | ||
71 | #define PP_VERSION "ppdev: user-space parallel port driver" | 72 | #define PP_VERSION "ppdev: user-space parallel port driver" |
@@ -638,6 +639,7 @@ static int pp_open (struct inode * inode, struct file * file) | |||
638 | unsigned int minor = iminor(inode); | 639 | unsigned int minor = iminor(inode); |
639 | struct pp_struct *pp; | 640 | struct pp_struct *pp; |
640 | 641 | ||
642 | cycle_kernel_lock(); | ||
641 | if (minor >= PARPORT_MAX) | 643 | if (minor >= PARPORT_MAX) |
642 | return -ENXIO; | 644 | return -ENXIO; |
643 | 645 | ||
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index bbfa0e241cba..505fcbe884a4 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/cdev.h> | 19 | #include <linux/cdev.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
22 | #include <linux/smp_lock.h> | ||
22 | 23 | ||
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | 25 | ||
@@ -53,6 +54,7 @@ static int raw_open(struct inode *inode, struct file *filp) | |||
53 | return 0; | 54 | return 0; |
54 | } | 55 | } |
55 | 56 | ||
57 | lock_kernel(); | ||
56 | mutex_lock(&raw_mutex); | 58 | mutex_lock(&raw_mutex); |
57 | 59 | ||
58 | /* | 60 | /* |
@@ -79,6 +81,7 @@ static int raw_open(struct inode *inode, struct file *filp) | |||
79 | bdev->bd_inode->i_mapping; | 81 | bdev->bd_inode->i_mapping; |
80 | filp->private_data = bdev; | 82 | filp->private_data = bdev; |
81 | mutex_unlock(&raw_mutex); | 83 | mutex_unlock(&raw_mutex); |
84 | unlock_kernel(); | ||
82 | return 0; | 85 | return 0; |
83 | 86 | ||
84 | out2: | 87 | out2: |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 909cac93fa2a..fa92a8af5a5a 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -73,6 +73,7 @@ | |||
73 | #include <linux/proc_fs.h> | 73 | #include <linux/proc_fs.h> |
74 | #include <linux/seq_file.h> | 74 | #include <linux/seq_file.h> |
75 | #include <linux/spinlock.h> | 75 | #include <linux/spinlock.h> |
76 | #include <linux/smp_lock.h> | ||
76 | #include <linux/sysctl.h> | 77 | #include <linux/sysctl.h> |
77 | #include <linux/wait.h> | 78 | #include <linux/wait.h> |
78 | #include <linux/bcd.h> | 79 | #include <linux/bcd.h> |
@@ -734,6 +735,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
734 | * needed here. Or anywhere else in this driver. */ | 735 | * needed here. Or anywhere else in this driver. */ |
735 | static int rtc_open(struct inode *inode, struct file *file) | 736 | static int rtc_open(struct inode *inode, struct file *file) |
736 | { | 737 | { |
738 | lock_kernel(); | ||
737 | spin_lock_irq(&rtc_lock); | 739 | spin_lock_irq(&rtc_lock); |
738 | 740 | ||
739 | if (rtc_status & RTC_IS_OPEN) | 741 | if (rtc_status & RTC_IS_OPEN) |
@@ -743,10 +745,12 @@ static int rtc_open(struct inode *inode, struct file *file) | |||
743 | 745 | ||
744 | rtc_irq_data = 0; | 746 | rtc_irq_data = 0; |
745 | spin_unlock_irq(&rtc_lock); | 747 | spin_unlock_irq(&rtc_lock); |
748 | unlock_kernel(); | ||
746 | return 0; | 749 | return 0; |
747 | 750 | ||
748 | out_busy: | 751 | out_busy: |
749 | spin_unlock_irq(&rtc_lock); | 752 | spin_unlock_irq(&rtc_lock); |
753 | unlock_kernel(); | ||
750 | return -EBUSY; | 754 | return -EBUSY; |
751 | } | 755 | } |
752 | 756 | ||
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c index 99e5272e3c53..1d9100561c8a 100644 --- a/drivers/char/scx200_gpio.c +++ b/drivers/char/scx200_gpio.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/smp_lock.h> | ||
15 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
16 | #include <asm/io.h> | 17 | #include <asm/io.h> |
17 | 18 | ||
@@ -51,6 +52,7 @@ static int scx200_gpio_open(struct inode *inode, struct file *file) | |||
51 | unsigned m = iminor(inode); | 52 | unsigned m = iminor(inode); |
52 | file->private_data = &scx200_gpio_ops; | 53 | file->private_data = &scx200_gpio_ops; |
53 | 54 | ||
55 | cycle_kernel_lock(); | ||
54 | if (m >= MAX_PINS) | 56 | if (m >= MAX_PINS) |
55 | return -EINVAL; | 57 | return -EINVAL; |
56 | return nonseekable_open(inode, file); | 58 | return nonseekable_open(inode, file); |
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index 8fe099a41065..0b799ac1b049 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/poll.h> | 21 | #include <linux/poll.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/smp_lock.h> | ||
24 | #include <asm/sn/io.h> | 25 | #include <asm/sn/io.h> |
25 | #include <asm/sn/sn_sal.h> | 26 | #include <asm/sn/sn_sal.h> |
26 | #include <asm/sn/module.h> | 27 | #include <asm/sn/module.h> |
@@ -104,6 +105,7 @@ scdrv_open(struct inode *inode, struct file *file) | |||
104 | file->private_data = sd; | 105 | file->private_data = sd; |
105 | 106 | ||
106 | /* hook this subchannel up to the system controller interrupt */ | 107 | /* hook this subchannel up to the system controller interrupt */ |
108 | lock_kernel(); | ||
107 | rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt, | 109 | rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt, |
108 | IRQF_SHARED | IRQF_DISABLED, | 110 | IRQF_SHARED | IRQF_DISABLED, |
109 | SYSCTL_BASENAME, sd); | 111 | SYSCTL_BASENAME, sd); |
@@ -111,9 +113,10 @@ scdrv_open(struct inode *inode, struct file *file) | |||
111 | ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); | 113 | ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); |
112 | kfree(sd); | 114 | kfree(sd); |
113 | printk("%s: irq request failed (%d)\n", __func__, rv); | 115 | printk("%s: irq request failed (%d)\n", __func__, rv); |
116 | unlock_kernel(); | ||
114 | return -EBUSY; | 117 | return -EBUSY; |
115 | } | 118 | } |
116 | 119 | unlock_kernel(); | |
117 | return 0; | 120 | return 0; |
118 | } | 121 | } |
119 | 122 | ||
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 58533de59027..85e0eb76eeab 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/err.h> | 49 | #include <linux/err.h> |
50 | #include <linux/kfifo.h> | 50 | #include <linux/kfifo.h> |
51 | #include <linux/platform_device.h> | 51 | #include <linux/platform_device.h> |
52 | #include <linux/smp_lock.h> | ||
52 | 53 | ||
53 | #include <asm/uaccess.h> | 54 | #include <asm/uaccess.h> |
54 | #include <asm/io.h> | 55 | #include <asm/io.h> |
@@ -906,12 +907,14 @@ static int sonypi_misc_release(struct inode *inode, struct file *file) | |||
906 | 907 | ||
907 | static int sonypi_misc_open(struct inode *inode, struct file *file) | 908 | static int sonypi_misc_open(struct inode *inode, struct file *file) |
908 | { | 909 | { |
910 | lock_kernel(); | ||
909 | mutex_lock(&sonypi_device.lock); | 911 | mutex_lock(&sonypi_device.lock); |
910 | /* Flush input queue on first open */ | 912 | /* Flush input queue on first open */ |
911 | if (!sonypi_device.open_count) | 913 | if (!sonypi_device.open_count) |
912 | kfifo_reset(sonypi_device.fifo); | 914 | kfifo_reset(sonypi_device.fifo); |
913 | sonypi_device.open_count++; | 915 | sonypi_device.open_count++; |
914 | mutex_unlock(&sonypi_device.lock); | 916 | mutex_unlock(&sonypi_device.lock); |
917 | unlock_kernel(); | ||
915 | return 0; | 918 | return 0; |
916 | } | 919 | } |
917 | 920 | ||
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c index 4c431cb7cf1b..6062b62800fd 100644 --- a/drivers/char/tb0219.c +++ b/drivers/char/tb0219.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/smp_lock.h> | ||
24 | 25 | ||
25 | #include <asm/io.h> | 26 | #include <asm/io.h> |
26 | #include <asm/reboot.h> | 27 | #include <asm/reboot.h> |
@@ -236,6 +237,7 @@ static int tanbac_tb0219_open(struct inode *inode, struct file *file) | |||
236 | { | 237 | { |
237 | unsigned int minor; | 238 | unsigned int minor; |
238 | 239 | ||
240 | cycle_kernel_lock(); | ||
239 | minor = iminor(inode); | 241 | minor = iminor(inode); |
240 | switch (minor) { | 242 | switch (minor) { |
241 | case 0: | 243 | case 0: |
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index 35e58030d296..8f2284be68e1 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/ioport.h> | 36 | #include <linux/ioport.h> |
37 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
38 | #include <linux/spinlock.h> | 38 | #include <linux/spinlock.h> |
39 | #include <linux/smp_lock.h> | ||
39 | #include <linux/timer.h> | 40 | #include <linux/timer.h> |
40 | #include <linux/sysfs.h> | 41 | #include <linux/sysfs.h> |
41 | #include <linux/device.h> | 42 | #include <linux/device.h> |
@@ -204,11 +205,14 @@ static int tlclk_open(struct inode *inode, struct file *filp) | |||
204 | { | 205 | { |
205 | int result; | 206 | int result; |
206 | 207 | ||
207 | if (test_and_set_bit(0, &useflags)) | 208 | lock_kernel(); |
208 | return -EBUSY; | 209 | if (test_and_set_bit(0, &useflags)) { |
210 | result = -EBUSY; | ||
209 | /* this legacy device is always one per system and it doesn't | 211 | /* this legacy device is always one per system and it doesn't |
210 | * know how to handle multiple concurrent clients. | 212 | * know how to handle multiple concurrent clients. |
211 | */ | 213 | */ |
214 | goto out; | ||
215 | } | ||
212 | 216 | ||
213 | /* Make sure there is no interrupt pending while | 217 | /* Make sure there is no interrupt pending while |
214 | * initialising interrupt handler */ | 218 | * initialising interrupt handler */ |
@@ -218,13 +222,14 @@ static int tlclk_open(struct inode *inode, struct file *filp) | |||
218 | * we can't share this IRQ */ | 222 | * we can't share this IRQ */ |
219 | result = request_irq(telclk_interrupt, &tlclk_interrupt, | 223 | result = request_irq(telclk_interrupt, &tlclk_interrupt, |
220 | IRQF_DISABLED, "telco_clock", tlclk_interrupt); | 224 | IRQF_DISABLED, "telco_clock", tlclk_interrupt); |
221 | if (result == -EBUSY) { | 225 | if (result == -EBUSY) |
222 | printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n"); | 226 | printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n"); |
223 | return -EBUSY; | 227 | else |
224 | } | 228 | inb(TLCLK_REG6); /* Clear interrupt events */ |
225 | inb(TLCLK_REG6); /* Clear interrupt events */ | ||
226 | 229 | ||
227 | return 0; | 230 | out: |
231 | unlock_kernel(); | ||
232 | return result; | ||
228 | } | 233 | } |
229 | 234 | ||
230 | static int tlclk_release(struct inode *inode, struct file *filp) | 235 | static int tlclk_release(struct inode *inode, struct file *filp) |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index a5d8bcb40000..e1fc193d9396 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/poll.h> | 26 | #include <linux/poll.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
29 | #include <linux/smp_lock.h> | ||
29 | 30 | ||
30 | #include "tpm.h" | 31 | #include "tpm.h" |
31 | 32 | ||
@@ -897,6 +898,7 @@ int tpm_open(struct inode *inode, struct file *file) | |||
897 | int rc = 0, minor = iminor(inode); | 898 | int rc = 0, minor = iminor(inode); |
898 | struct tpm_chip *chip = NULL, *pos; | 899 | struct tpm_chip *chip = NULL, *pos; |
899 | 900 | ||
901 | lock_kernel(); | ||
900 | spin_lock(&driver_lock); | 902 | spin_lock(&driver_lock); |
901 | 903 | ||
902 | list_for_each_entry(pos, &tpm_chip_list, list) { | 904 | list_for_each_entry(pos, &tpm_chip_list, list) { |
@@ -926,16 +928,19 @@ int tpm_open(struct inode *inode, struct file *file) | |||
926 | if (chip->data_buffer == NULL) { | 928 | if (chip->data_buffer == NULL) { |
927 | chip->num_opens--; | 929 | chip->num_opens--; |
928 | put_device(chip->dev); | 930 | put_device(chip->dev); |
931 | unlock_kernel(); | ||
929 | return -ENOMEM; | 932 | return -ENOMEM; |
930 | } | 933 | } |
931 | 934 | ||
932 | atomic_set(&chip->data_pending, 0); | 935 | atomic_set(&chip->data_pending, 0); |
933 | 936 | ||
934 | file->private_data = chip; | 937 | file->private_data = chip; |
938 | unlock_kernel(); | ||
935 | return 0; | 939 | return 0; |
936 | 940 | ||
937 | err_out: | 941 | err_out: |
938 | spin_unlock(&driver_lock); | 942 | spin_unlock(&driver_lock); |
943 | unlock_kernel(); | ||
939 | return rc; | 944 | return rc; |
940 | } | 945 | } |
941 | EXPORT_SYMBOL_GPL(tpm_open); | 946 | EXPORT_SYMBOL_GPL(tpm_open); |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 750131010af0..047a17339f83 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -2665,7 +2665,7 @@ static void release_dev(struct file *filp) | |||
2665 | * ->siglock protects ->signal/->sighand | 2665 | * ->siglock protects ->signal/->sighand |
2666 | */ | 2666 | */ |
2667 | 2667 | ||
2668 | static int tty_open(struct inode *inode, struct file *filp) | 2668 | static int __tty_open(struct inode *inode, struct file *filp) |
2669 | { | 2669 | { |
2670 | struct tty_struct *tty; | 2670 | struct tty_struct *tty; |
2671 | int noctty, retval; | 2671 | int noctty, retval; |
@@ -2779,6 +2779,19 @@ got_driver: | |||
2779 | return 0; | 2779 | return 0; |
2780 | } | 2780 | } |
2781 | 2781 | ||
2782 | /* BKL pushdown: scary code avoidance wrapper */ | ||
2783 | static int tty_open(struct inode *inode, struct file *filp) | ||
2784 | { | ||
2785 | int ret; | ||
2786 | |||
2787 | lock_kernel(); | ||
2788 | ret = __tty_open(inode, filp); | ||
2789 | unlock_kernel(); | ||
2790 | return ret; | ||
2791 | } | ||
2792 | |||
2793 | |||
2794 | |||
2782 | #ifdef CONFIG_UNIX98_PTYS | 2795 | #ifdef CONFIG_UNIX98_PTYS |
2783 | /** | 2796 | /** |
2784 | * ptmx_open - open a unix 98 pty master | 2797 | * ptmx_open - open a unix 98 pty master |
@@ -2792,7 +2805,7 @@ got_driver: | |||
2792 | * allocated_ptys_lock handles the list of free pty numbers | 2805 | * allocated_ptys_lock handles the list of free pty numbers |
2793 | */ | 2806 | */ |
2794 | 2807 | ||
2795 | static int ptmx_open(struct inode *inode, struct file *filp) | 2808 | static int __ptmx_open(struct inode *inode, struct file *filp) |
2796 | { | 2809 | { |
2797 | struct tty_struct *tty; | 2810 | struct tty_struct *tty; |
2798 | int retval; | 2811 | int retval; |
@@ -2831,6 +2844,16 @@ out: | |||
2831 | devpts_kill_index(index); | 2844 | devpts_kill_index(index); |
2832 | return retval; | 2845 | return retval; |
2833 | } | 2846 | } |
2847 | |||
2848 | static int ptmx_open(struct inode *inode, struct file *filp) | ||
2849 | { | ||
2850 | int ret; | ||
2851 | |||
2852 | lock_kernel(); | ||
2853 | ret = __ptmx_open(inode, filp); | ||
2854 | unlock_kernel(); | ||
2855 | return ret; | ||
2856 | } | ||
2834 | #endif | 2857 | #endif |
2835 | 2858 | ||
2836 | /** | 2859 | /** |
@@ -2886,15 +2909,16 @@ static int tty_fasync(int fd, struct file *filp, int on) | |||
2886 | { | 2909 | { |
2887 | struct tty_struct *tty; | 2910 | struct tty_struct *tty; |
2888 | unsigned long flags; | 2911 | unsigned long flags; |
2889 | int retval; | 2912 | int retval = 0; |
2890 | 2913 | ||
2914 | lock_kernel(); | ||
2891 | tty = (struct tty_struct *)filp->private_data; | 2915 | tty = (struct tty_struct *)filp->private_data; |
2892 | if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync")) | 2916 | if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync")) |
2893 | return 0; | 2917 | goto out; |
2894 | 2918 | ||
2895 | retval = fasync_helper(fd, filp, on, &tty->fasync); | 2919 | retval = fasync_helper(fd, filp, on, &tty->fasync); |
2896 | if (retval <= 0) | 2920 | if (retval <= 0) |
2897 | return retval; | 2921 | goto out; |
2898 | 2922 | ||
2899 | if (on) { | 2923 | if (on) { |
2900 | enum pid_type type; | 2924 | enum pid_type type; |
@@ -2912,12 +2936,15 @@ static int tty_fasync(int fd, struct file *filp, int on) | |||
2912 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | 2936 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
2913 | retval = __f_setown(filp, pid, type, 0); | 2937 | retval = __f_setown(filp, pid, type, 0); |
2914 | if (retval) | 2938 | if (retval) |
2915 | return retval; | 2939 | goto out; |
2916 | } else { | 2940 | } else { |
2917 | if (!tty->fasync && !waitqueue_active(&tty->read_wait)) | 2941 | if (!tty->fasync && !waitqueue_active(&tty->read_wait)) |
2918 | tty->minimum_to_wake = N_TTY_BUF_SIZE; | 2942 | tty->minimum_to_wake = N_TTY_BUF_SIZE; |
2919 | } | 2943 | } |
2920 | return 0; | 2944 | retval = 0; |
2945 | out: | ||
2946 | unlock_kernel(); | ||
2947 | return retval; | ||
2921 | } | 2948 | } |
2922 | 2949 | ||
2923 | /** | 2950 | /** |
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index 83aeedda200c..eebfad2777d2 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/kbd_kern.h> | 34 | #include <linux/kbd_kern.h> |
35 | #include <linux/console.h> | 35 | #include <linux/console.h> |
36 | #include <linux/device.h> | 36 | #include <linux/device.h> |
37 | #include <linux/smp_lock.h> | ||
37 | 38 | ||
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
39 | #include <asm/byteorder.h> | 40 | #include <asm/byteorder.h> |
@@ -460,9 +461,13 @@ static int | |||
460 | vcs_open(struct inode *inode, struct file *filp) | 461 | vcs_open(struct inode *inode, struct file *filp) |
461 | { | 462 | { |
462 | unsigned int currcons = iminor(inode) & 127; | 463 | unsigned int currcons = iminor(inode) & 127; |
464 | int ret = 0; | ||
465 | |||
466 | lock_kernel(); | ||
463 | if(currcons && !vc_cons_allocated(currcons-1)) | 467 | if(currcons && !vc_cons_allocated(currcons-1)) |
464 | return -ENXIO; | 468 | ret = -ENXIO; |
465 | return 0; | 469 | unlock_kernel(); |
470 | return ret; | ||
466 | } | 471 | } |
467 | 472 | ||
468 | static const struct file_operations vcs_fops = { | 473 | static const struct file_operations vcs_fops = { |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index c39ddaff5e8f..977f7d35e769 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/completion.h> | 46 | #include <linux/completion.h> |
47 | #include <linux/proc_fs.h> | 47 | #include <linux/proc_fs.h> |
48 | #include <linux/seq_file.h> | 48 | #include <linux/seq_file.h> |
49 | #include <linux/smp_lock.h> | ||
49 | 50 | ||
50 | #include <asm/uaccess.h> | 51 | #include <asm/uaccess.h> |
51 | #include <asm/ioctls.h> | 52 | #include <asm/ioctls.h> |
@@ -687,6 +688,7 @@ static int viotap_open(struct inode *inode, struct file *file) | |||
687 | if (op == NULL) | 688 | if (op == NULL) |
688 | return -ENOMEM; | 689 | return -ENOMEM; |
689 | 690 | ||
691 | lock_kernel(); | ||
690 | get_dev_info(file->f_path.dentry->d_inode, &devi); | 692 | get_dev_info(file->f_path.dentry->d_inode, &devi); |
691 | 693 | ||
692 | /* Note: We currently only support one mode! */ | 694 | /* Note: We currently only support one mode! */ |
@@ -717,6 +719,7 @@ static int viotap_open(struct inode *inode, struct file *file) | |||
717 | 719 | ||
718 | free_op: | 720 | free_op: |
719 | free_op_struct(op); | 721 | free_op_struct(op); |
722 | unlock_kernel(); | ||
720 | return ret; | 723 | return ret; |
721 | } | 724 | } |
722 | 725 | ||
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c index e5ed09192be8..ffe9b4e3072e 100644 --- a/drivers/char/vr41xx_giu.c +++ b/drivers/char/vr41xx_giu.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/smp_lock.h> | ||
30 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
31 | #include <linux/types.h> | 32 | #include <linux/types.h> |
32 | 33 | ||
@@ -547,6 +548,7 @@ static int gpio_open(struct inode *inode, struct file *file) | |||
547 | { | 548 | { |
548 | unsigned int pin; | 549 | unsigned int pin; |
549 | 550 | ||
551 | cycle_kernel_lock(); | ||
550 | pin = iminor(inode); | 552 | pin = iminor(inode); |
551 | if (pin >= giu_nr_pins) | 553 | if (pin >= giu_nr_pins) |
552 | return -EBADF; | 554 | return -EBADF; |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index 3edf1fc12963..1e1b81e57cdc 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
@@ -85,6 +85,7 @@ | |||
85 | #include <linux/poll.h> | 85 | #include <linux/poll.h> |
86 | #include <linux/proc_fs.h> | 86 | #include <linux/proc_fs.h> |
87 | #include <linux/mutex.h> | 87 | #include <linux/mutex.h> |
88 | #include <linux/smp_lock.h> | ||
88 | #include <linux/sysctl.h> | 89 | #include <linux/sysctl.h> |
89 | #include <linux/version.h> | 90 | #include <linux/version.h> |
90 | #include <linux/fs.h> | 91 | #include <linux/fs.h> |
@@ -504,11 +505,12 @@ static int hwicap_open(struct inode *inode, struct file *file) | |||
504 | struct hwicap_drvdata *drvdata; | 505 | struct hwicap_drvdata *drvdata; |
505 | int status; | 506 | int status; |
506 | 507 | ||
508 | lock_kernel(); | ||
507 | drvdata = container_of(inode->i_cdev, struct hwicap_drvdata, cdev); | 509 | drvdata = container_of(inode->i_cdev, struct hwicap_drvdata, cdev); |
508 | 510 | ||
509 | status = mutex_lock_interruptible(&drvdata->sem); | 511 | status = mutex_lock_interruptible(&drvdata->sem); |
510 | if (status) | 512 | if (status) |
511 | return status; | 513 | goto out; |
512 | 514 | ||
513 | if (drvdata->is_open) { | 515 | if (drvdata->is_open) { |
514 | status = -EBUSY; | 516 | status = -EBUSY; |
@@ -528,6 +530,8 @@ static int hwicap_open(struct inode *inode, struct file *file) | |||
528 | 530 | ||
529 | error: | 531 | error: |
530 | mutex_unlock(&drvdata->sem); | 532 | mutex_unlock(&drvdata->sem); |
533 | out: | ||
534 | unlock_kernel(); | ||
531 | return status; | 535 | return status; |
532 | } | 536 | } |
533 | 537 | ||