Merge branch 'config' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl

* 'config' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
BKL: introduce CONFIG_BKL.
dabusb: remove the BKL
sunrpc: remove the big kernel lock
init/main.c: remove BKL notations
blktrace: remove the big kernel lock
rtmutex-tester: make it build without BKL
dvb-core: kill the big kernel lock
dvb/bt8xx: kill the big kernel lock
tlclk: remove big kernel lock
fix rawctl compat ioctls breakage on amd64 and itanic
uml: kill big kernel lock
parisc: remove big kernel lock
cris: autoconvert trivial BKL users
alpha: kill big kernel lock
isapnp: BKL removal
s390/block: kill the big kernel lock
hpet: kill BKL, add compat_ioctl

+348 -403
+4 -3
arch/cris/arch-v10/drivers/ds1302.c
··· 19 19 #include <linux/module.h> 20 20 #include <linux/miscdevice.h> 21 21 #include <linux/delay.h> 22 - #include <linux/smp_lock.h> 22 + #include <linux/mutex.h> 23 23 #include <linux/bcd.h> 24 24 #include <linux/capability.h> 25 25 ··· 34 34 35 35 #define RTC_MAJOR_NR 121 /* local major, change later */ 36 36 37 + static DEFINE_MUTEX(ds1302_mutex); 37 38 static const char ds1302_name[] = "ds1302"; 38 39 39 40 /* The DS1302 might be connected to different bits on different products. ··· 358 357 { 359 358 int ret; 360 359 361 - lock_kernel(); 360 + mutex_lock(&ds1302_mutex); 362 361 ret = rtc_ioctl(file, cmd, arg); 363 - unlock_kernel(); 362 + mutex_unlock(&ds1302_mutex); 364 363 365 364 return ret; 366 365 }
+3 -3
arch/cris/arch-v10/drivers/pcf8563.c
··· 27 27 #include <linux/delay.h> 28 28 #include <linux/bcd.h> 29 29 #include <linux/mutex.h> 30 - #include <linux/smp_lock.h> 31 30 32 31 #include <asm/uaccess.h> 33 32 #include <asm/system.h> ··· 48 49 #define rtc_read(x) i2c_readreg(RTC_I2C_READ, x) 49 50 #define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y) 50 51 52 + static DEFINE_MUTEX(pcf8563_mutex); 51 53 static DEFINE_MUTEX(rtc_lock); /* Protect state etc */ 52 54 53 55 static const unsigned char days_in_month[] = ··· 343 343 { 344 344 int ret; 345 345 346 - lock_kernel(); 346 + mutex_lock(&pcf8563_mutex); 347 347 return pcf8563_ioctl(filp, cmd, arg); 348 - unlock_kernel(); 348 + mutex_unlock(&pcf8563_mutex); 349 349 350 350 return ret; 351 351 }
+6 -5
arch/cris/arch-v10/drivers/sync_serial.c
··· 20 20 #include <linux/interrupt.h> 21 21 #include <linux/poll.h> 22 22 #include <linux/init.h> 23 - #include <linux/smp_lock.h> 23 + #include <linux/mutex.h> 24 24 #include <linux/timer.h> 25 25 #include <asm/irq.h> 26 26 #include <asm/dma.h> ··· 149 149 }; 150 150 151 151 152 + static DEFINE_MUTEX(sync_serial_mutex); 152 153 static int etrax_sync_serial_init(void); 153 154 static void initialize_port(int portnbr); 154 155 static inline int sync_data_avail(struct sync_port *port); ··· 446 445 int mode; 447 446 int err = -EBUSY; 448 447 449 - lock_kernel(); 448 + mutex_lock(&sync_serial_mutex); 450 449 DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev)); 451 450 452 451 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) { ··· 627 626 ret = 0; 628 627 629 628 out: 630 - unlock_kernel(); 629 + mutex_unlock(&sync_serial_mutex); 631 630 return ret; 632 631 } 633 632 ··· 962 961 { 963 962 long ret; 964 963 965 - lock_kernel(); 964 + mutex_lock(&sync_serial_mutex); 966 965 ret = sync_serial_ioctl_unlocked(file, cmd, arg); 967 - unlock_kernel(); 966 + mutex_unlock(&sync_serial_mutex); 968 967 969 968 return ret; 970 969 }
+2 -2
arch/cris/arch-v32/drivers/cryptocop.c
··· 3139 3139 struct inode *inode = file->f_path.dentry->d_inode; 3140 3140 long ret; 3141 3141 3142 - lock_kernel(); 3142 + mutex_lock(&cryptocop_mutex); 3143 3143 ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg); 3144 - unlock_kernel(); 3144 + mutex_unlock(&cryptocop_mutex); 3145 3145 3146 3146 return ret; 3147 3147 }
+6 -5
arch/cris/arch-v32/drivers/mach-a3/gpio.c
··· 23 23 #include <linux/init.h> 24 24 #include <linux/interrupt.h> 25 25 #include <linux/spinlock.h> 26 - #include <linux/smp_lock.h> 26 + #include <linux/mutex.h> 27 27 28 28 #include <asm/etraxgpio.h> 29 29 #include <hwregs/reg_map.h> ··· 66 66 #define DP(x) 67 67 #endif 68 68 69 + static DEFINE_MUTEX(gpio_mutex); 69 70 static char gpio_name[] = "etrax gpio"; 70 71 71 72 #ifdef CONFIG_ETRAX_VIRTUAL_GPIO ··· 392 391 if (!priv) 393 392 return -ENOMEM; 394 393 395 - lock_kernel(); 394 + mutex_lock(&gpio_mutex); 396 395 memset(priv, 0, sizeof(*priv)); 397 396 398 397 priv->minor = p; ··· 415 414 spin_unlock_irq(&gpio_lock); 416 415 } 417 416 418 - unlock_kernel(); 417 + mutex_unlock(&gpio_mutex); 419 418 return 0; 420 419 } 421 420 ··· 668 667 { 669 668 long ret; 670 669 671 - lock_kernel(); 670 + mutex_lock(&gpio_mutex); 672 671 ret = gpio_ioctl_unlocked(file, cmd, arg); 673 - unlock_kernel(); 672 + mutex_unlock(&gpio_mutex); 674 673 675 674 return ret; 676 675 }
+6 -5
arch/cris/arch-v32/drivers/mach-fs/gpio.c
··· 22 22 #include <linux/init.h> 23 23 #include <linux/interrupt.h> 24 24 #include <linux/spinlock.h> 25 - #include <linux/smp_lock.h> 25 + #include <linux/mutex.h> 26 26 27 27 #include <asm/etraxgpio.h> 28 28 #include <hwregs/reg_map.h> ··· 64 64 #define DP(x) 65 65 #endif 66 66 67 + static DEFINE_MUTEX(gpio_mutex); 67 68 static char gpio_name[] = "etrax gpio"; 68 69 69 70 #if 0 ··· 430 429 if (!priv) 431 430 return -ENOMEM; 432 431 433 - lock_kernel(); 432 + mutex_lock(&gpio_mutex); 434 433 memset(priv, 0, sizeof(*priv)); 435 434 436 435 priv->minor = p; ··· 451 450 alarmlist = priv; 452 451 spin_unlock_irq(&alarm_lock); 453 452 454 - unlock_kernel(); 453 + mutex_unlock(&gpio_mutex); 455 454 return 0; 456 455 } 457 456 ··· 709 708 { 710 709 long ret; 711 710 712 - lock_kernel(); 711 + mutex_lock(&gpio_mutex); 713 712 ret = gpio_ioctl_unlocked(file, cmd, arg); 714 - unlock_kernel(); 713 + mutex_unlock(&gpio_mutex); 715 714 716 715 return ret; 717 716 }
+3 -3
arch/cris/arch-v32/drivers/pcf8563.c
··· 24 24 #include <linux/init.h> 25 25 #include <linux/fs.h> 26 26 #include <linux/ioctl.h> 27 - #include <linux/smp_lock.h> 28 27 #include <linux/delay.h> 29 28 #include <linux/bcd.h> 30 29 #include <linux/mutex.h> ··· 44 45 #define rtc_read(x) i2c_readreg(RTC_I2C_READ, x) 45 46 #define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y) 46 47 48 + static DEFINE_MUTEX(pcf8563_mutex); 47 49 static DEFINE_MUTEX(rtc_lock); /* Protect state etc */ 48 50 49 51 static const unsigned char days_in_month[] = ··· 339 339 { 340 340 int ret; 341 341 342 - lock_kernel(); 342 + mutex_lock(&pcf8563_mutex); 343 343 return pcf8563_ioctl(filp, cmd, arg); 344 - unlock_kernel(); 344 + mutex_unlock(&pcf8563_mutex); 345 345 346 346 return ret; 347 347 }
+6 -5
arch/cris/arch-v32/drivers/sync_serial.c
··· 13 13 #include <linux/errno.h> 14 14 #include <linux/major.h> 15 15 #include <linux/sched.h> 16 - #include <linux/smp_lock.h> 16 + #include <linux/mutex.h> 17 17 #include <linux/interrupt.h> 18 18 #include <linux/poll.h> 19 19 #include <linux/init.h> ··· 145 145 spinlock_t lock; 146 146 } sync_port; 147 147 148 + static DEFINE_MUTEX(sync_serial_mutex); 148 149 static int etrax_sync_serial_init(void); 149 150 static void initialize_port(int portnbr); 150 151 static inline int sync_data_avail(struct sync_port *port); ··· 435 434 reg_dma_rw_cfg cfg = {.en = regk_dma_yes}; 436 435 reg_dma_rw_intr_mask intr_mask = {.data = regk_dma_yes}; 437 436 438 - lock_kernel(); 437 + mutex_lock(&sync_serial_mutex); 439 438 DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev)); 440 439 441 440 if (dev < 0 || dev >= NBR_PORTS || !ports[dev].enabled) ··· 584 583 port->busy++; 585 584 ret = 0; 586 585 out: 587 - unlock_kernel(); 586 + mutex_unlock(&sync_serial_mutex); 588 587 return ret; 589 588 } 590 589 ··· 967 966 { 968 967 long ret; 969 968 970 - lock_kernel(); 969 + mutex_lock(&sync_serial_mutex); 971 970 ret = sync_serial_ioctl_unlocked(file, cmd, arg); 972 - unlock_kernel(); 971 + mutex_unlock(&sync_serial_mutex); 973 972 974 973 return ret; 975 974 }
-4
arch/parisc/kernel/perf.c
··· 46 46 #include <linux/init.h> 47 47 #include <linux/proc_fs.h> 48 48 #include <linux/miscdevice.h> 49 - #include <linux/smp_lock.h> 50 49 #include <linux/spinlock.h> 51 50 52 51 #include <asm/uaccess.h> ··· 260 261 */ 261 262 static int perf_open(struct inode *inode, struct file *file) 262 263 { 263 - lock_kernel(); 264 264 spin_lock(&perf_lock); 265 265 if (perf_enabled) { 266 266 spin_unlock(&perf_lock); 267 - unlock_kernel(); 268 267 return -EBUSY; 269 268 } 270 269 perf_enabled = 1; 271 270 spin_unlock(&perf_lock); 272 - unlock_kernel(); 273 271 274 272 return 0; 275 273 }
+7 -6
arch/um/drivers/harddog_kern.c
··· 42 42 #include <linux/miscdevice.h> 43 43 #include <linux/watchdog.h> 44 44 #include <linux/reboot.h> 45 - #include <linux/smp_lock.h> 45 + #include <linux/mutex.h> 46 46 #include <linux/init.h> 47 47 #include <linux/spinlock.h> 48 48 #include <asm/uaccess.h> ··· 50 50 51 51 MODULE_LICENSE("GPL"); 52 52 53 + static DEFINE_MUTEX(harddog_mutex); 53 54 static DEFINE_SPINLOCK(lock); 54 55 static int timer_alive; 55 56 static int harddog_in_fd = -1; ··· 67 66 int err = -EBUSY; 68 67 char *sock = NULL; 69 68 70 - lock_kernel(); 69 + mutex_lock(&harddog_mutex); 71 70 spin_lock(&lock); 72 71 if(timer_alive) 73 72 goto err; ··· 84 83 85 84 timer_alive = 1; 86 85 spin_unlock(&lock); 87 - unlock_kernel(); 86 + mutex_unlock(&harddog_mutex); 88 87 return nonseekable_open(inode, file); 89 88 err: 90 89 spin_unlock(&lock); 91 - unlock_kernel(); 90 + mutex_unlock(&harddog_mutex); 92 91 return err; 93 92 } 94 93 ··· 154 153 { 155 154 long ret; 156 155 157 - lock_kernel(); 156 + mutex_lock(&harddog_mutex); 158 157 ret = harddog_ioctl_unlocked(file, cmd, arg); 159 - unlock_kernel(); 158 + mutex_unlock(&harddog_mutex); 160 159 161 160 return ret; 162 161 }
+7 -5
arch/um/drivers/hostaudio_kern.c
··· 8 8 #include "linux/slab.h" 9 9 #include "linux/sound.h" 10 10 #include "linux/soundcard.h" 11 - #include "linux/smp_lock.h" 11 + #include "linux/mutex.h" 12 12 #include "asm/uaccess.h" 13 13 #include "init.h" 14 14 #include "os.h" ··· 62 62 63 63 __uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP); 64 64 #endif 65 + 66 + static DEFINE_MUTEX(hostaudio_mutex); 65 67 66 68 /* /dev/dsp file operations */ 67 69 ··· 200 198 w = 1; 201 199 202 200 kparam_block_sysfs_write(dsp); 203 - lock_kernel(); 201 + mutex_lock(&hostaudio_mutex); 204 202 ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); 205 - unlock_kernel(); 203 + mutex_unlock(&hostaudio_mutex); 206 204 kparam_unblock_sysfs_write(dsp); 207 205 208 206 if (ret < 0) { ··· 261 259 w = 1; 262 260 263 261 kparam_block_sysfs_write(mixer); 264 - lock_kernel(); 262 + mutex_lock(&hostaudio_mutex); 265 263 ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0); 266 - unlock_kernel(); 264 + mutex_unlock(&hostaudio_mutex); 267 265 kparam_unblock_sysfs_write(mixer); 268 266 269 267 if (ret < 0) {
+6 -5
arch/um/drivers/ubd_kern.c
··· 33 33 #include "linux/mm.h" 34 34 #include "linux/slab.h" 35 35 #include "linux/vmalloc.h" 36 - #include "linux/smp_lock.h" 36 + #include "linux/mutex.h" 37 37 #include "linux/blkpg.h" 38 38 #include "linux/genhd.h" 39 39 #include "linux/spinlock.h" ··· 100 100 #define DRIVER_NAME "uml-blkdev" 101 101 102 102 static DEFINE_MUTEX(ubd_lock); 103 + static DEFINE_MUTEX(ubd_mutex); /* replaces BKL, might not be needed */ 103 104 104 105 static int ubd_open(struct block_device *bdev, fmode_t mode); 105 106 static int ubd_release(struct gendisk *disk, fmode_t mode); ··· 1102 1101 struct ubd *ubd_dev = disk->private_data; 1103 1102 int err = 0; 1104 1103 1105 - lock_kernel(); 1104 + mutex_lock(&ubd_mutex); 1106 1105 if(ubd_dev->count == 0){ 1107 1106 err = ubd_open_dev(ubd_dev); 1108 1107 if(err){ ··· 1121 1120 err = -EROFS; 1122 1121 }*/ 1123 1122 out: 1124 - unlock_kernel(); 1123 + mutex_unlock(&ubd_mutex); 1125 1124 return err; 1126 1125 } 1127 1126 ··· 1129 1128 { 1130 1129 struct ubd *ubd_dev = disk->private_data; 1131 1130 1132 - lock_kernel(); 1131 + mutex_lock(&ubd_mutex); 1133 1132 if(--ubd_dev->count == 0) 1134 1133 ubd_close_dev(ubd_dev); 1135 - unlock_kernel(); 1134 + mutex_unlock(&ubd_mutex); 1136 1135 return 0; 1137 1136 } 1138 1137
-2
arch/um/kernel/exec.c
··· 78 78 long error; 79 79 char *filename; 80 80 81 - lock_kernel(); 82 81 filename = getname(file); 83 82 error = PTR_ERR(filename); 84 83 if (IS_ERR(filename)) goto out; 85 84 error = execve1(filename, argv, env); 86 85 putname(filename); 87 86 out: 88 - unlock_kernel(); 89 87 return error; 90 88 }
+64 -34
drivers/char/hpet.c
··· 30 30 #include <linux/bcd.h> 31 31 #include <linux/seq_file.h> 32 32 #include <linux/bitops.h> 33 + #include <linux/compat.h> 33 34 #include <linux/clocksource.h> 34 35 #include <linux/slab.h> 35 36 ··· 68 67 #define read_counter(MC) readl(MC) 69 68 #endif 70 69 70 + static DEFINE_MUTEX(hpet_mutex); /* replaces BKL */ 71 71 static u32 hpet_nhpet, hpet_max_freq = HPET_USER_FREQ; 72 72 73 73 /* This clocksource driver currently only works on ia64 */ ··· 252 250 if (file->f_mode & FMODE_WRITE) 253 251 return -EINVAL; 254 252 255 - lock_kernel(); 253 + mutex_lock(&hpet_mutex); 256 254 spin_lock_irq(&hpet_lock); 257 255 258 256 for (devp = NULL, hpetp = hpets; hpetp && !devp; hpetp = hpetp->hp_next) ··· 266 264 267 265 if (!devp) { 268 266 spin_unlock_irq(&hpet_lock); 269 - unlock_kernel(); 267 + mutex_unlock(&hpet_mutex); 270 268 return -EBUSY; 271 269 } 272 270 ··· 274 272 devp->hd_irqdata = 0; 275 273 devp->hd_flags |= HPET_OPEN; 276 274 spin_unlock_irq(&hpet_lock); 277 - unlock_kernel(); 275 + mutex_unlock(&hpet_mutex); 278 276 279 277 hpet_timer_set_irq(devp); 280 278 ··· 431 429 return 0; 432 430 } 433 431 434 - static int hpet_ioctl_common(struct hpet_dev *, int, unsigned long, int); 435 - 436 - static long hpet_ioctl(struct file *file, unsigned int cmd, 437 - unsigned long arg) 438 - { 439 - struct hpet_dev *devp; 440 - int ret; 441 - 442 - devp = file->private_data; 443 - lock_kernel(); 444 - ret = hpet_ioctl_common(devp, cmd, arg, 0); 445 - unlock_kernel(); 446 - 447 - return ret; 448 - } 449 - 450 432 static int hpet_ioctl_ieon(struct hpet_dev *devp) 451 433 { 452 434 struct hpet_timer __iomem *timer; ··· 539 553 } 540 554 541 555 static int 542 - hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel) 556 + hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, 557 + struct hpet_info *info) 543 558 { 544 559 struct hpet_timer __iomem *timer; 545 560 struct hpet __iomem *hpet; ··· 581 594 break; 582 595 case HPET_INFO: 583 596 { 584 - struct hpet_info info; 585 - 586 597 if (devp->hd_ireqfreq) 587 - info.hi_ireqfreq = 598 + info->hi_ireqfreq = 588 599 hpet_time_div(hpetp, devp->hd_ireqfreq); 589 600 else 590 - info.hi_ireqfreq = 0; 591 - info.hi_flags = 601 + info->hi_ireqfreq = 0; 602 + info->hi_flags = 592 603 readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK; 593 - info.hi_hpet = hpetp->hp_which; 594 - info.hi_timer = devp - hpetp->hp_dev; 595 - if (kernel) 596 - memcpy((void *)arg, &info, sizeof(info)); 597 - else 598 - if (copy_to_user((void __user *)arg, &info, 599 - sizeof(info))) 600 - err = -EFAULT; 604 + info->hi_hpet = hpetp->hp_which; 605 + info->hi_timer = devp - hpetp->hp_dev; 601 606 break; 602 607 } 603 608 case HPET_EPI: ··· 615 636 devp->hd_flags &= ~HPET_PERIODIC; 616 637 break; 617 638 case HPET_IRQFREQ: 618 - if (!kernel && (arg > hpet_max_freq) && 639 + if ((arg > hpet_max_freq) && 619 640 !capable(CAP_SYS_RESOURCE)) { 620 641 err = -EACCES; 621 642 break; ··· 632 653 return err; 633 654 } 634 655 656 + static long 657 + hpet_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 658 + { 659 + struct hpet_info info; 660 + int err; 661 + 662 + mutex_lock(&hpet_mutex); 663 + err = hpet_ioctl_common(file->private_data, cmd, arg, &info); 664 + mutex_unlock(&hpet_mutex); 665 + 666 + if ((cmd == HPET_INFO) && !err && 667 + (copy_to_user((void __user *)arg, &info, sizeof(info)))) 668 + err = -EFAULT; 669 + 670 + return err; 671 + } 672 + 673 + #ifdef CONFIG_COMPAT 674 + struct compat_hpet_info { 675 + compat_ulong_t hi_ireqfreq; /* Hz */ 676 + compat_ulong_t hi_flags; /* information */ 677 + unsigned short hi_hpet; 678 + unsigned short hi_timer; 679 + }; 680 + 681 + static long 682 + hpet_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 683 + { 684 + struct hpet_info info; 685 + int err; 686 + 687 + mutex_lock(&hpet_mutex); 688 + err = hpet_ioctl_common(file->private_data, cmd, arg, &info); 689 + mutex_unlock(&hpet_mutex); 690 + 691 + if ((cmd == HPET_INFO) && !err) { 692 + struct compat_hpet_info __user *u = compat_ptr(arg); 693 + if (put_user(info.hi_ireqfreq, &u->hi_ireqfreq) || 694 + put_user(info.hi_flags, &u->hi_flags) || 695 + put_user(info.hi_hpet, &u->hi_hpet) || 696 + put_user(info.hi_timer, &u->hi_timer)) 697 + err = -EFAULT; 698 + } 699 + 700 + return err; 701 + } 702 + #endif 703 + 635 704 static const struct file_operations hpet_fops = { 636 705 .owner = THIS_MODULE, 637 706 .llseek = no_llseek, 638 707 .read = hpet_read, 639 708 .poll = hpet_poll, 640 709 .unlocked_ioctl = hpet_ioctl, 710 + #ifdef CONFIG_COMPAT 711 + .compat_ioctl = hpet_compat_ioctl, 712 + #endif 641 713 .open = hpet_open, 642 714 .release = hpet_release, 643 715 .fasync = hpet_fasync,
+141 -104
drivers/char/raw.c
··· 19 19 #include <linux/cdev.h> 20 20 #include <linux/device.h> 21 21 #include <linux/mutex.h> 22 - #include <linux/smp_lock.h> 23 22 #include <linux/gfp.h> 23 + #include <linux/compat.h> 24 24 25 25 #include <asm/uaccess.h> 26 26 ··· 55 55 return 0; 56 56 } 57 57 58 - lock_kernel(); 59 58 mutex_lock(&raw_mutex); 60 59 61 60 /* ··· 81 82 bdev->bd_inode->i_mapping; 82 83 filp->private_data = bdev; 83 84 mutex_unlock(&raw_mutex); 84 - unlock_kernel(); 85 85 return 0; 86 86 87 87 out2: ··· 89 91 blkdev_put(bdev, filp->f_mode); 90 92 out: 91 93 mutex_unlock(&raw_mutex); 92 - unlock_kernel(); 93 94 return err; 94 95 } 95 96 ··· 122 125 raw_ioctl(struct file *filp, unsigned int command, unsigned long arg) 123 126 { 124 127 struct block_device *bdev = filp->private_data; 125 - int ret; 126 - 127 - lock_kernel(); 128 - ret = blkdev_ioctl(bdev, 0, command, arg); 129 - unlock_kernel(); 130 - 131 - return ret; 128 + return blkdev_ioctl(bdev, 0, command, arg); 132 129 } 133 130 134 - static void bind_device(struct raw_config_request *rq) 131 + static int bind_set(int number, u64 major, u64 minor) 135 132 { 136 - device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor)); 137 - device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), NULL, 138 - "raw%d", rq->raw_minor); 133 + dev_t dev = MKDEV(major, minor); 134 + struct raw_device_data *rawdev; 135 + int err = 0; 136 + 137 + if (number <= 0 || number >= MAX_RAW_MINORS) 138 + return -EINVAL; 139 + 140 + if (MAJOR(dev) != major || MINOR(dev) != minor) 141 + return -EINVAL; 142 + 143 + rawdev = &raw_devices[number]; 144 + 145 + /* 146 + * This is like making block devices, so demand the 147 + * same capability 148 + */ 149 + if (!capable(CAP_SYS_ADMIN)) 150 + return -EPERM; 151 + 152 + /* 153 + * For now, we don't need to check that the underlying 154 + * block device is present or not: we can do that when 155 + * the raw device is opened. Just check that the 156 + * major/minor numbers make sense. 157 + */ 158 + 159 + if (MAJOR(dev) == 0 && dev != 0) 160 + return -EINVAL; 161 + 162 + mutex_lock(&raw_mutex); 163 + if (rawdev->inuse) { 164 + mutex_unlock(&raw_mutex); 165 + return -EBUSY; 166 + } 167 + if (rawdev->binding) { 168 + bdput(rawdev->binding); 169 + module_put(THIS_MODULE); 170 + } 171 + if (!dev) { 172 + /* unbind */ 173 + rawdev->binding = NULL; 174 + device_destroy(raw_class, MKDEV(RAW_MAJOR, number)); 175 + } else { 176 + rawdev->binding = bdget(dev); 177 + if (rawdev->binding == NULL) { 178 + err = -ENOMEM; 179 + } else { 180 + dev_t raw = MKDEV(RAW_MAJOR, number); 181 + __module_get(THIS_MODULE); 182 + device_destroy(raw_class, raw); 183 + device_create(raw_class, NULL, raw, NULL, 184 + "raw%d", number); 185 + } 186 + } 187 + mutex_unlock(&raw_mutex); 188 + return err; 189 + } 190 + 191 + static int bind_get(int number, dev_t *dev) 192 + { 193 + struct raw_device_data *rawdev; 194 + struct block_device *bdev; 195 + 196 + if (number <= 0 || number >= MAX_RAW_MINORS) 197 + return -EINVAL; 198 + 199 + rawdev = &raw_devices[number]; 200 + 201 + mutex_lock(&raw_mutex); 202 + bdev = rawdev->binding; 203 + *dev = bdev ? bdev->bd_dev : 0; 204 + mutex_unlock(&raw_mutex); 205 + return 0; 139 206 } 140 207 141 208 /* ··· 210 149 unsigned long arg) 211 150 { 212 151 struct raw_config_request rq; 213 - struct raw_device_data *rawdev; 214 - int err = 0; 152 + dev_t dev; 153 + int err; 215 154 216 - lock_kernel(); 217 155 switch (command) { 218 156 case RAW_SETBIND: 157 + if (copy_from_user(&rq, (void __user *) arg, sizeof(rq))) 158 + return -EFAULT; 159 + 160 + return bind_set(rq.raw_minor, rq.block_major, rq.block_minor); 161 + 219 162 case RAW_GETBIND: 163 + if (copy_from_user(&rq, (void __user *) arg, sizeof(rq))) 164 + return -EFAULT; 220 165 221 - /* First, find out which raw minor we want */ 166 + err = bind_get(rq.raw_minor, &dev); 167 + if (err) 168 + return err; 222 169 223 - if (copy_from_user(&rq, (void __user *) arg, sizeof(rq))) { 224 - err = -EFAULT; 225 - goto out; 226 - } 170 + rq.block_major = MAJOR(dev); 171 + rq.block_minor = MINOR(dev); 227 172 228 - if (rq.raw_minor <= 0 || rq.raw_minor >= MAX_RAW_MINORS) { 229 - err = -EINVAL; 230 - goto out; 231 - } 232 - rawdev = &raw_devices[rq.raw_minor]; 173 + if (copy_to_user((void __user *)arg, &rq, sizeof(rq))) 174 + return -EFAULT; 233 175 234 - if (command == RAW_SETBIND) { 235 - dev_t dev; 236 - 237 - /* 238 - * This is like making block devices, so demand the 239 - * same capability 240 - */ 241 - if (!capable(CAP_SYS_ADMIN)) { 242 - err = -EPERM; 243 - goto out; 244 - } 245 - 246 - /* 247 - * For now, we don't need to check that the underlying 248 - * block device is present or not: we can do that when 249 - * the raw device is opened. Just check that the 250 - * major/minor numbers make sense. 251 - */ 252 - 253 - dev = MKDEV(rq.block_major, rq.block_minor); 254 - if ((rq.block_major == 0 && rq.block_minor != 0) || 255 - MAJOR(dev) != rq.block_major || 256 - MINOR(dev) != rq.block_minor) { 257 - err = -EINVAL; 258 - goto out; 259 - } 260 - 261 - mutex_lock(&raw_mutex); 262 - if (rawdev->inuse) { 263 - mutex_unlock(&raw_mutex); 264 - err = -EBUSY; 265 - goto out; 266 - } 267 - if (rawdev->binding) { 268 - bdput(rawdev->binding); 269 - module_put(THIS_MODULE); 270 - } 271 - if (rq.block_major == 0 && rq.block_minor == 0) { 272 - /* unbind */ 273 - rawdev->binding = NULL; 274 - device_destroy(raw_class, 275 - MKDEV(RAW_MAJOR, rq.raw_minor)); 276 - } else { 277 - rawdev->binding = bdget(dev); 278 - if (rawdev->binding == NULL) 279 - err = -ENOMEM; 280 - else { 281 - __module_get(THIS_MODULE); 282 - bind_device(&rq); 283 - } 284 - } 285 - mutex_unlock(&raw_mutex); 286 - } else { 287 - struct block_device *bdev; 288 - 289 - mutex_lock(&raw_mutex); 290 - bdev = rawdev->binding; 291 - if (bdev) { 292 - rq.block_major = MAJOR(bdev->bd_dev); 293 - rq.block_minor = MINOR(bdev->bd_dev); 294 - } else { 295 - rq.block_major = rq.block_minor = 0; 296 - } 297 - mutex_unlock(&raw_mutex); 298 - if (copy_to_user((void __user *)arg, &rq, sizeof(rq))) { 299 - err = -EFAULT; 300 - goto out; 301 - } 302 - } 303 - break; 304 - default: 305 - err = -EINVAL; 306 - break; 176 + return 0; 307 177 } 308 - out: 309 - unlock_kernel(); 310 - return err; 178 + 179 + return -EINVAL; 311 180 } 181 + 182 + #ifdef CONFIG_COMPAT 183 + struct raw32_config_request { 184 + compat_int_t raw_minor; 185 + compat_u64 block_major; 186 + compat_u64 block_minor; 187 + }; 188 + 189 + static long raw_ctl_compat_ioctl(struct file *file, unsigned int cmd, 190 + unsigned long arg) 191 + { 192 + struct raw32_config_request __user *user_req = compat_ptr(arg); 193 + struct raw32_config_request rq; 194 + dev_t dev; 195 + int err = 0; 196 + 197 + switch (cmd) { 198 + case RAW_SETBIND: 199 + if (copy_from_user(&rq, user_req, sizeof(rq))) 200 + return -EFAULT; 201 + 202 + return bind_set(rq.raw_minor, rq.block_major, rq.block_minor); 203 + 204 + case RAW_GETBIND: 205 + if (copy_from_user(&rq, user_req, sizeof(rq))) 206 + return -EFAULT; 207 + 208 + err = bind_get(rq.raw_minor, &dev); 209 + if (err) 210 + return err; 211 + 212 + rq.block_major = MAJOR(dev); 213 + rq.block_minor = MINOR(dev); 214 + 215 + if (copy_to_user(user_req, &rq, sizeof(rq))) 216 + return -EFAULT; 217 + 218 + return 0; 219 + } 220 + 221 + return -EINVAL; 222 + } 223 + #endif 312 224 313 225 static const struct file_operations raw_fops = { 314 226 .read = do_sync_read, ··· 297 263 298 264 static const struct file_operations raw_ctl_fops = { 299 265 .unlocked_ioctl = raw_ctl_ioctl, 266 + #ifdef CONFIG_COMPAT 267 + .compat_ioctl = raw_ctl_compat_ioctl, 268 + #endif 300 269 .open = raw_open, 301 270 .owner = THIS_MODULE, 302 271 };
+3 -3
drivers/char/tlclk.c
··· 37 37 #include <linux/ioport.h> 38 38 #include <linux/interrupt.h> 39 39 #include <linux/spinlock.h> 40 - #include <linux/smp_lock.h> 40 + #include <linux/mutex.h> 41 41 #include <linux/timer.h> 42 42 #include <linux/sysfs.h> 43 43 #include <linux/device.h> ··· 206 206 { 207 207 int result; 208 208 209 - lock_kernel(); 209 + mutex_lock(&tlclk_mutex); 210 210 if (test_and_set_bit(0, &useflags)) { 211 211 result = -EBUSY; 212 212 /* this legacy device is always one per system and it doesn't ··· 229 229 inb(TLCLK_REG6); /* Clear interrupt events */ 230 230 231 231 out: 232 - unlock_kernel(); 232 + mutex_unlock(&tlclk_mutex); 233 233 return result; 234 234 } 235 235
+4 -1
drivers/gpu/drm/Kconfig
··· 73 73 74 74 config DRM_I810 75 75 tristate "Intel I810" 76 - depends on DRM && AGP && AGP_INTEL 76 + # BKL usage in order to avoid AB-BA deadlocks, may become BROKEN_ON_SMP 77 + depends on DRM && AGP && AGP_INTEL && BKL 77 78 help 78 79 Choose this option if you have an Intel I810 graphics card. If M is 79 80 selected, the module will be called i810. AGP support is required ··· 87 86 88 87 config DRM_I830 89 88 tristate "i830 driver" 89 + # BKL usage in order to avoid AB-BA deadlocks, i830 may get removed 90 + depends on BKL 90 91 help 91 92 Choose this option if you have a system that has Intel 830M, 845G, 92 93 852GM, 855GM or 865G integrated graphics. If M is selected, the
+1
drivers/media/Kconfig
··· 19 19 20 20 config VIDEO_DEV 21 21 tristate "Video For Linux" 22 + depends on BKL # used in many drivers for ioctl handling, need to kill 22 23 ---help--- 23 24 V4L core support for video capture and overlay devices, webcams and 24 25 AM/FM radio cards.
+4 -3
drivers/media/dvb/bt8xx/dst_ca.c
··· 22 22 #include <linux/module.h> 23 23 #include <linux/slab.h> 24 24 #include <linux/init.h> 25 - #include <linux/smp_lock.h> 25 + #include <linux/mutex.h> 26 26 #include <linux/string.h> 27 27 #include <linux/dvb/ca.h> 28 28 #include "dvbdev.h" ··· 52 52 } while(0) 53 53 54 54 55 + static DEFINE_MUTEX(dst_ca_mutex); 55 56 static unsigned int verbose = 5; 56 57 module_param(verbose, int, 0644); 57 58 MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); ··· 565 564 void __user *arg = (void __user *)ioctl_arg; 566 565 int result = 0; 567 566 568 - lock_kernel(); 567 + mutex_lock(&dst_ca_mutex); 569 568 dvbdev = file->private_data; 570 569 state = (struct dst_state *)dvbdev->priv; 571 570 p_ca_message = kmalloc(sizeof (struct ca_msg), GFP_KERNEL); ··· 653 652 kfree (p_ca_slot_info); 654 653 kfree (p_ca_caps); 655 654 656 - unlock_kernel(); 655 + mutex_unlock(&dst_ca_mutex); 657 656 return result; 658 657 } 659 658
+2 -15
drivers/media/dvb/dvb-core/dmxdev.c
··· 25 25 #include <linux/slab.h> 26 26 #include <linux/vmalloc.h> 27 27 #include <linux/module.h> 28 - #include <linux/smp_lock.h> 29 28 #include <linux/poll.h> 30 29 #include <linux/ioctl.h> 31 30 #include <linux/wait.h> ··· 1087 1088 static long dvb_demux_ioctl(struct file *file, unsigned int cmd, 1088 1089 unsigned long arg) 1089 1090 { 1090 - int ret; 1091 - 1092 - lock_kernel(); 1093 - ret = dvb_usercopy(file, cmd, arg, dvb_demux_do_ioctl); 1094 - unlock_kernel(); 1095 - 1096 - return ret; 1091 + return dvb_usercopy(file, cmd, arg, dvb_demux_do_ioctl); 1097 1092 } 1098 1093 1099 1094 static unsigned int dvb_demux_poll(struct file *file, poll_table *wait) ··· 1179 1186 static long dvb_dvr_ioctl(struct file *file, 1180 1187 unsigned int cmd, unsigned long arg) 1181 1188 { 1182 - int ret; 1183 - 1184 - lock_kernel(); 1185 - ret = dvb_usercopy(file, cmd, arg, dvb_dvr_do_ioctl); 1186 - unlock_kernel(); 1187 - 1188 - return ret; 1189 + return dvb_usercopy(file, cmd, arg, dvb_dvr_do_ioctl); 1189 1190 } 1190 1191 1191 1192 static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait)
+1 -7
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
··· 1259 1259 static long dvb_ca_en50221_io_ioctl(struct file *file, 1260 1260 unsigned int cmd, unsigned long arg) 1261 1261 { 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 + return dvb_usercopy(file, cmd, arg, dvb_ca_en50221_io_do_ioctl); 1269 1263 } 1270 1264 1271 1265
+1 -8
drivers/media/dvb/dvb-core/dvb_net.c
··· 59 59 #include <linux/netdevice.h> 60 60 #include <linux/etherdevice.h> 61 61 #include <linux/dvb/net.h> 62 - #include <linux/smp_lock.h> 63 62 #include <linux/uio.h> 64 63 #include <asm/uaccess.h> 65 64 #include <linux/crc32.h> ··· 1444 1445 static long dvb_net_ioctl(struct file *file, 1445 1446 unsigned int cmd, unsigned long arg) 1446 1447 { 1447 - int ret; 1448 - 1449 - lock_kernel(); 1450 - ret = dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl); 1451 - unlock_kernel(); 1452 - 1453 - return ret; 1448 + return dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl); 1454 1449 } 1455 1450 1456 1451 static int dvb_net_close(struct inode *inode, struct file *file)
+7 -10
drivers/media/dvb/dvb-core/dvbdev.c
··· 32 32 #include <linux/fs.h> 33 33 #include <linux/cdev.h> 34 34 #include <linux/mutex.h> 35 - #include <linux/smp_lock.h> 36 35 #include "dvbdev.h" 37 36 37 + static DEFINE_MUTEX(dvbdev_mutex); 38 38 static int dvbdev_debug; 39 39 40 40 module_param(dvbdev_debug, int, 0644); ··· 68 68 { 69 69 struct dvb_device *dvbdev; 70 70 71 - lock_kernel(); 71 + mutex_lock(&dvbdev_mutex); 72 72 down_read(&minor_rwsem); 73 73 dvbdev = dvb_minors[iminor(inode)]; 74 74 ··· 91 91 } 92 92 fops_put(old_fops); 93 93 up_read(&minor_rwsem); 94 - unlock_kernel(); 94 + mutex_unlock(&dvbdev_mutex); 95 95 return err; 96 96 } 97 97 fail: 98 98 up_read(&minor_rwsem); 99 - unlock_kernel(); 99 + mutex_unlock(&dvbdev_mutex); 100 100 return -ENODEV; 101 101 } 102 102 ··· 158 158 unsigned int cmd, unsigned long arg) 159 159 { 160 160 struct dvb_device *dvbdev = file->private_data; 161 - int ret; 162 161 163 162 if (!dvbdev) 164 163 return -ENODEV; ··· 165 166 if (!dvbdev->kernel_ioctl) 166 167 return -EINVAL; 167 168 168 - lock_kernel(); 169 - ret = dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl); 170 - unlock_kernel(); 171 - 172 - return ret; 169 + return dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl); 173 170 } 174 171 EXPORT_SYMBOL(dvb_generic_ioctl); 175 172 ··· 416 421 } 417 422 418 423 /* call driver */ 424 + mutex_lock(&dvbdev_mutex); 419 425 if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD) 420 426 err = -EINVAL; 427 + mutex_unlock(&dvbdev_mutex); 421 428 422 429 if (err < 0) 423 430 goto out;
+3 -15
drivers/media/video/dabusb.c
··· 32 32 #include <linux/list.h> 33 33 #include <linux/vmalloc.h> 34 34 #include <linux/slab.h> 35 - #include <linux/smp_lock.h> 36 35 #include <linux/init.h> 37 36 #include <asm/uaccess.h> 38 37 #include <asm/atomic.h> ··· 620 621 if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB)) 621 622 return -EIO; 622 623 623 - lock_kernel(); 624 624 s = &dabusb[devnum - DABUSB_MINOR]; 625 625 626 626 dbg("dabusb_open"); ··· 628 630 while (!s->usbdev || s->opened) { 629 631 mutex_unlock(&s->mutex); 630 632 631 - if (file->f_flags & O_NONBLOCK) { 633 + if (file->f_flags & O_NONBLOCK) 632 634 return -EBUSY; 633 - } 634 635 msleep_interruptible(500); 635 636 636 - if (signal_pending (current)) { 637 - unlock_kernel(); 637 + if (signal_pending (current)) 638 638 return -EAGAIN; 639 - } 640 639 mutex_lock(&s->mutex); 641 640 } 642 641 if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) { 643 642 mutex_unlock(&s->mutex); 644 643 dev_err(&s->usbdev->dev, "set_interface failed\n"); 645 - unlock_kernel(); 646 644 return -EINVAL; 647 645 } 648 646 s->opened = 1; ··· 648 654 file->private_data = s; 649 655 650 656 r = nonseekable_open(inode, file); 651 - unlock_kernel(); 652 657 return r; 653 658 } 654 659 ··· 682 689 683 690 dbg("dabusb_ioctl"); 684 691 685 - lock_kernel(); 686 - if (s->remove_pending) { 687 - unlock_kernel(); 692 + if (s->remove_pending) 688 693 return -EIO; 689 - } 690 694 691 695 mutex_lock(&s->mutex); 692 696 693 697 if (!s->usbdev) { 694 698 mutex_unlock(&s->mutex); 695 - unlock_kernel(); 696 699 return -EIO; 697 700 } 698 701 ··· 724 735 break; 725 736 } 726 737 mutex_unlock(&s->mutex); 727 - unlock_kernel(); 728 738 return ret; 729 739 } 730 740
+1
drivers/net/appletalk/Kconfig
··· 3 3 # 4 4 config ATALK 5 5 tristate "Appletalk protocol support" 6 + depends on BKL # waiting to be removed from net/appletalk/ddp.c 6 7 select LLC 7 8 ---help--- 8 9 AppleTalk is the protocol that Apple computers can use to communicate
+8 -7
drivers/pnp/isapnp/proc.c
··· 31 31 static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence) 32 32 { 33 33 loff_t new = -1; 34 + struct inode *inode = file->f_path.dentry->d_inode; 34 35 35 - lock_kernel(); 36 + mutex_lock(&inode->i_mutex); 36 37 switch (whence) { 37 38 case 0: 38 39 new = off; ··· 45 44 new = 256 + off; 46 45 break; 47 46 } 48 - if (new < 0 || new > 256) { 49 - unlock_kernel(); 50 - return -EINVAL; 51 - } 52 - unlock_kernel(); 53 - return (file->f_pos = new); 47 + if (new < 0 || new > 256) 48 + new = -EINVAL; 49 + else 50 + file->f_pos = new; 51 + mutex_unlock(&inode->i_mutex); 52 + return new; 54 53 } 55 54 56 55 static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf,
-6
drivers/s390/block/dasd.c
··· 21 21 #include <linux/hdreg.h> 22 22 #include <linux/async.h> 23 23 #include <linux/mutex.h> 24 - #include <linux/smp_lock.h> 25 24 26 25 #include <asm/ccwdev.h> 27 26 #include <asm/ebcdic.h> ··· 2235 2236 if (!block) 2236 2237 return -ENODEV; 2237 2238 2238 - lock_kernel(); 2239 2239 base = block->base; 2240 2240 atomic_inc(&block->open_count); 2241 2241 if (test_bit(DASD_FLAG_OFFLINE, &base->flags)) { ··· 2269 2271 goto out; 2270 2272 } 2271 2273 2272 - unlock_kernel(); 2273 2274 return 0; 2274 2275 2275 2276 out: 2276 2277 module_put(base->discipline->owner); 2277 2278 unlock: 2278 2279 atomic_dec(&block->open_count); 2279 - unlock_kernel(); 2280 2280 return rc; 2281 2281 } 2282 2282 ··· 2282 2286 { 2283 2287 struct dasd_block *block = disk->private_data; 2284 2288 2285 - lock_kernel(); 2286 2289 atomic_dec(&block->open_count); 2287 2290 module_put(block->base->discipline->owner); 2288 - unlock_kernel(); 2289 2291 return 0; 2290 2292 } 2291 2293
+2 -15
drivers/s390/block/dasd_ioctl.c
··· 16 16 #include <linux/major.h> 17 17 #include <linux/fs.h> 18 18 #include <linux/blkpg.h> 19 - #include <linux/smp_lock.h> 20 19 #include <linux/slab.h> 21 20 #include <asm/compat.h> 22 21 #include <asm/ccwdev.h> ··· 369 370 return ret; 370 371 } 371 372 372 - static int 373 - dasd_do_ioctl(struct block_device *bdev, fmode_t mode, 374 - unsigned int cmd, unsigned long arg) 373 + int dasd_ioctl(struct block_device *bdev, fmode_t mode, 374 + unsigned int cmd, unsigned long arg) 375 375 { 376 376 struct dasd_block *block = bdev->bd_disk->private_data; 377 377 void __user *argp; ··· 427 429 428 430 return -EINVAL; 429 431 } 430 - } 431 - 432 - int dasd_ioctl(struct block_device *bdev, fmode_t mode, 433 - unsigned int cmd, unsigned long arg) 434 - { 435 - int rc; 436 - 437 - lock_kernel(); 438 - rc = dasd_do_ioctl(bdev, mode, cmd, arg); 439 - unlock_kernel(); 440 - return rc; 441 432 }
-5
drivers/s390/block/dcssblk.c
··· 14 14 #include <linux/init.h> 15 15 #include <linux/slab.h> 16 16 #include <linux/blkdev.h> 17 - #include <linux/smp_lock.h> 18 17 #include <linux/completion.h> 19 18 #include <linux/interrupt.h> 20 19 #include <linux/platform_device.h> ··· 775 776 struct dcssblk_dev_info *dev_info; 776 777 int rc; 777 778 778 - lock_kernel(); 779 779 dev_info = bdev->bd_disk->private_data; 780 780 if (NULL == dev_info) { 781 781 rc = -ENODEV; ··· 784 786 bdev->bd_block_size = 4096; 785 787 rc = 0; 786 788 out: 787 - unlock_kernel(); 788 789 return rc; 789 790 } 790 791 ··· 794 797 struct segment_info *entry; 795 798 int rc; 796 799 797 - lock_kernel(); 798 800 if (!dev_info) { 799 801 rc = -ENODEV; 800 802 goto out; ··· 811 815 up_write(&dcssblk_devices_sem); 812 816 rc = 0; 813 817 out: 814 - unlock_kernel(); 815 818 return rc; 816 819 } 817 820
+1
drivers/staging/cx25821/Kconfig
··· 1 1 config VIDEO_CX25821 2 2 tristate "Conexant cx25821 support" 3 3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT 4 + depends on BKL # please fix 4 5 select I2C_ALGOBIT 5 6 select VIDEO_BTCX 6 7 select VIDEO_TVEEPROM
+1
drivers/staging/easycap/Kconfig
··· 1 1 config EASYCAP 2 2 tristate "EasyCAP USB ID 05e1:0408 support" 3 3 depends on USB && VIDEO_DEV 4 + depends on BKL # please fix 4 5 5 6 ---help--- 6 7 This is an integrated audio/video driver for EasyCAP cards with
+1
drivers/staging/go7007/Kconfig
··· 1 1 config VIDEO_GO7007 2 2 tristate "WIS GO7007 MPEG encoder support" 3 3 depends on VIDEO_DEV && PCI && I2C && INPUT 4 + depends on BKL # please fix 4 5 depends on SND 5 6 select VIDEOBUF_DMA_SG 6 7 select VIDEO_IR
+1 -1
drivers/staging/usbip/Kconfig
··· 1 1 config USB_IP_COMMON 2 2 tristate "USB IP support (EXPERIMENTAL)" 3 - depends on USB && NET && EXPERIMENTAL 3 + depends on USB && NET && EXPERIMENTAL && BKL 4 4 default N 5 5 ---help--- 6 6 This enables pushing USB packets over IP to allow remote
+1
fs/Kconfig
··· 50 50 config FILE_LOCKING 51 51 bool "Enable POSIX file locking API" if EMBEDDED 52 52 default y 53 + select BKL # while lockd still uses it. 53 54 help 54 55 This option enables standard file locking support, required 55 56 for filesystems like NFS and for the flock() system
+1
fs/adfs/Kconfig
··· 1 1 config ADFS_FS 2 2 tristate "ADFS file system support (EXPERIMENTAL)" 3 3 depends on BLOCK && EXPERIMENTAL 4 + depends on BKL # need to fix 4 5 help 5 6 The Acorn Disc Filing System is the standard file system of the 6 7 RiscOS operating system which runs on Acorn's ARM-based Risc PC
+1
fs/autofs/Kconfig
··· 1 1 config AUTOFS_FS 2 2 tristate "Kernel automounter support" 3 + depends on BKL # unfixable, just use autofs4 3 4 help 4 5 The automounter is a tool to automatically mount remote file systems 5 6 on demand. This implementation is partially kernel-based to reduce
-70
fs/compat_ioctl.c
··· 599 599 #define HIDPGETCONNLIST _IOR('H', 210, int) 600 600 #define HIDPGETCONNINFO _IOR('H', 211, int) 601 601 602 - #ifdef CONFIG_BLOCK 603 - struct raw32_config_request 604 - { 605 - compat_int_t raw_minor; 606 - __u64 block_major; 607 - __u64 block_minor; 608 - } __attribute__((packed)); 609 - 610 - static int get_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req) 611 - { 612 - int ret; 613 - 614 - if (!access_ok(VERIFY_READ, user_req, sizeof(struct raw32_config_request))) 615 - return -EFAULT; 616 - 617 - ret = __get_user(req->raw_minor, &user_req->raw_minor); 618 - ret |= __get_user(req->block_major, &user_req->block_major); 619 - ret |= __get_user(req->block_minor, &user_req->block_minor); 620 - 621 - return ret ? -EFAULT : 0; 622 - } 623 - 624 - static int set_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req) 625 - { 626 - int ret; 627 - 628 - if (!access_ok(VERIFY_WRITE, user_req, sizeof(struct raw32_config_request))) 629 - return -EFAULT; 630 - 631 - ret = __put_user(req->raw_minor, &user_req->raw_minor); 632 - ret |= __put_user(req->block_major, &user_req->block_major); 633 - ret |= __put_user(req->block_minor, &user_req->block_minor); 634 - 635 - return ret ? -EFAULT : 0; 636 - } 637 - 638 - static int raw_ioctl(unsigned fd, unsigned cmd, 639 - struct raw32_config_request __user *user_req) 640 - { 641 - int ret; 642 - 643 - switch (cmd) { 644 - case RAW_SETBIND: 645 - default: { /* RAW_GETBIND */ 646 - struct raw_config_request req; 647 - mm_segment_t oldfs = get_fs(); 648 - 649 - if ((ret = get_raw32_request(&req, user_req))) 650 - return ret; 651 - 652 - set_fs(KERNEL_DS); 653 - ret = sys_ioctl(fd,cmd,(unsigned long)&req); 654 - set_fs(oldfs); 655 - 656 - if ((!ret) && (cmd == RAW_GETBIND)) { 657 - ret = set_raw32_request(&req, user_req); 658 - } 659 - break; 660 - } 661 - } 662 - return ret; 663 - } 664 - #endif /* CONFIG_BLOCK */ 665 602 666 603 struct serial_struct32 { 667 604 compat_int_t type; ··· 1199 1262 COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS) 1200 1263 COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS) 1201 1264 COMPATIBLE_IOCTL(OSS_GETVERSION) 1202 - /* Raw devices */ 1203 - COMPATIBLE_IOCTL(RAW_SETBIND) 1204 - COMPATIBLE_IOCTL(RAW_GETBIND) 1205 1265 /* SMB ioctls which do not need any translations */ 1206 1266 COMPATIBLE_IOCTL(SMB_IOC_NEWCONN) 1207 1267 /* Watchdog */ ··· 1457 1523 case MTIOCGET32: 1458 1524 case MTIOCPOS32: 1459 1525 return mt_ioctl_trans(fd, cmd, argp); 1460 - /* Raw devices */ 1461 - case RAW_SETBIND: 1462 - case RAW_GETBIND: 1463 - return raw_ioctl(fd, cmd, argp); 1464 1526 #endif 1465 1527 /* One SMB ioctl needs translations. */ 1466 1528 #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
+1
fs/hpfs/Kconfig
··· 1 1 config HPFS_FS 2 2 tristate "OS/2 HPFS file system support" 3 3 depends on BLOCK 4 + depends on BKL # nontrivial to fix 4 5 help 5 6 OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS 6 7 is the file system used for organizing files on OS/2 hard disk
+1
fs/nfs/Kconfig
··· 1 1 config NFS_FS 2 2 tristate "NFS client support" 3 3 depends on INET && FILE_LOCKING 4 + depends on BKL # fix as soon as lockd is done 4 5 select LOCKD 5 6 select SUNRPC 6 7 select NFS_ACL_SUPPORT if NFS_V3_ACL
+1
fs/nfsd/Kconfig
··· 2 2 tristate "NFS server support" 3 3 depends on INET 4 4 depends on FILE_LOCKING 5 + depends on BKL # fix as soon as lockd is done 5 6 select LOCKD 6 7 select SUNRPC 7 8 select EXPORTFS
+1
fs/smbfs/Kconfig
··· 1 1 config SMB_FS 2 2 tristate "SMB file system support (OBSOLETE, please use CIFS)" 3 + depends on BKL # probably unfixable 3 4 depends on INET 4 5 select NLS 5 6 help
+1
fs/udf/Kconfig
··· 1 1 config UDF_FS 2 2 tristate "UDF file system support" 3 + depends on BKL # needs serious work to remove 3 4 select CRC_ITU_T 4 5 help 5 6 This is the new file system used on some CD-ROMs and DVDs. Say Y if
+1
fs/ufs/Kconfig
··· 1 1 config UFS_FS 2 2 tristate "UFS file system support (read only)" 3 3 depends on BLOCK 4 + depends on BKL # probably fixable 4 5 help 5 6 BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD, 6 7 OpenBSD and NeXTstep) use a file system called UFS. Some System V
+5 -2
include/linux/smp_lock.h
··· 54 54 55 55 #else 56 56 57 + #ifdef CONFIG_BKL /* provoke build bug if not set */ 57 58 #define lock_kernel() 58 59 #define unlock_kernel() 59 - #define release_kernel_lock(task) do { } while(0) 60 60 #define cycle_kernel_lock() do { } while(0) 61 - #define reacquire_kernel_lock(task) 0 62 61 #define kernel_locked() 1 62 + #endif /* CONFIG_BKL */ 63 + 64 + #define release_kernel_lock(task) do { } while(0) 65 + #define reacquire_kernel_lock(task) 0 63 66 64 67 #endif /* CONFIG_LOCK_KERNEL */ 65 68 #endif /* __LINUX_SMPLOCK_H */
+1 -1
init/Kconfig
··· 71 71 72 72 config LOCK_KERNEL 73 73 bool 74 - depends on SMP || PREEMPT 74 + depends on (SMP || PREEMPT) && BKL 75 75 default y 76 76 77 77 config INIT_ENV_ARG_LIMIT
-2
init/main.c
··· 424 424 static __initdata DECLARE_COMPLETION(kthreadd_done); 425 425 426 426 static noinline void __init_refok rest_init(void) 427 - __releases(kernel_lock) 428 427 { 429 428 int pid; 430 429 ··· 817 818 * makes it inline to init() and it becomes part of init.text section 818 819 */ 819 820 static noinline int init_post(void) 820 - __releases(kernel_lock) 821 821 { 822 822 /* need to finish all async __init code before freeing the memory */ 823 823 async_synchronize_full();
+6
kernel/rtmutex-tester.c
··· 76 76 } 77 77 78 78 if (!lockwakeup && td->bkl == 4) { 79 + #ifdef CONFIG_LOCK_KERNEL 79 80 unlock_kernel(); 81 + #endif 80 82 td->bkl = 0; 81 83 } 82 84 return 0; ··· 135 133 if (td->bkl) 136 134 return 0; 137 135 td->bkl = 1; 136 + #ifdef CONFIG_LOCK_KERNEL 138 137 lock_kernel(); 138 + #endif 139 139 td->bkl = 4; 140 140 return 0; 141 141 142 142 case RTTEST_UNLOCKBKL: 143 143 if (td->bkl != 4) 144 144 break; 145 + #ifdef CONFIG_LOCK_KERNEL 145 146 unlock_kernel(); 147 + #endif 146 148 td->bkl = 0; 147 149 return 0; 148 150
+3 -11
kernel/trace/blktrace.c
··· 23 23 #include <linux/mutex.h> 24 24 #include <linux/slab.h> 25 25 #include <linux/debugfs.h> 26 - #include <linux/smp_lock.h> 27 26 #include <linux/time.h> 28 27 #include <linux/uaccess.h> 29 28 ··· 638 639 if (!q) 639 640 return -ENXIO; 640 641 641 - lock_kernel(); 642 642 mutex_lock(&bdev->bd_mutex); 643 643 644 644 switch (cmd) { ··· 665 667 } 666 668 667 669 mutex_unlock(&bdev->bd_mutex); 668 - unlock_kernel(); 669 670 return ret; 670 671 } 671 672 ··· 1649 1652 struct block_device *bdev; 1650 1653 ssize_t ret = -ENXIO; 1651 1654 1652 - lock_kernel(); 1653 1655 bdev = bdget(part_devt(p)); 1654 1656 if (bdev == NULL) 1655 - goto out_unlock_kernel; 1657 + goto out; 1656 1658 1657 1659 q = blk_trace_get_queue(bdev); 1658 1660 if (q == NULL) ··· 1679 1683 mutex_unlock(&bdev->bd_mutex); 1680 1684 out_bdput: 1681 1685 bdput(bdev); 1682 - out_unlock_kernel: 1683 - unlock_kernel(); 1686 + out: 1684 1687 return ret; 1685 1688 } 1686 1689 ··· 1709 1714 1710 1715 ret = -ENXIO; 1711 1716 1712 - lock_kernel(); 1713 1717 p = dev_to_part(dev); 1714 1718 bdev = bdget(part_devt(p)); 1715 1719 if (bdev == NULL) 1716 - goto out_unlock_kernel; 1720 + goto out; 1717 1721 1718 1722 q = blk_trace_get_queue(bdev); 1719 1723 if (q == NULL) ··· 1747 1753 mutex_unlock(&bdev->bd_mutex); 1748 1754 out_bdput: 1749 1755 bdput(bdev); 1750 - out_unlock_kernel: 1751 - unlock_kernel(); 1752 1756 out: 1753 1757 return ret ? ret : count; 1754 1758 }
+9
lib/Kconfig.debug
··· 461 461 This feature allows mutex semantics violations to be detected and 462 462 reported. 463 463 464 + config BKL 465 + bool "Big Kernel Lock" if (SMP || PREEMPT) 466 + default y 467 + help 468 + This is the traditional lock that is used in old code instead 469 + of proper locking. All drivers that use the BKL should depend 470 + on this symbol. 471 + Say Y here unless you are working on removing the BKL. 472 + 464 473 config DEBUG_LOCK_ALLOC 465 474 bool "Lock debugging: detect incorrect freeing of live locks" 466 475 depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
+1
net/ipx/Kconfig
··· 3 3 # 4 4 config IPX 5 5 tristate "The IPX protocol" 6 + depends on BKL # should be fixable 6 7 select LLC 7 8 ---help--- 8 9 This is support for the Novell networking protocol, IPX, commonly
+2 -13
net/sunrpc/cache.c
··· 28 28 #include <linux/workqueue.h> 29 29 #include <linux/mutex.h> 30 30 #include <linux/pagemap.h> 31 - #include <linux/smp_lock.h> 32 31 #include <asm/ioctls.h> 33 32 #include <linux/sunrpc/types.h> 34 33 #include <linux/sunrpc/cache.h> ··· 1347 1348 static long cache_ioctl_procfs(struct file *filp, 1348 1349 unsigned int cmd, unsigned long arg) 1349 1350 { 1350 - long ret; 1351 1351 struct inode *inode = filp->f_path.dentry->d_inode; 1352 1352 struct cache_detail *cd = PDE(inode)->data; 1353 1353 1354 - lock_kernel(); 1355 - ret = cache_ioctl(inode, filp, cmd, arg, cd); 1356 - unlock_kernel(); 1357 - 1358 - return ret; 1354 + return cache_ioctl(inode, filp, cmd, arg, cd); 1359 1355 } 1360 1356 1361 1357 static int cache_open_procfs(struct inode *inode, struct file *filp) ··· 1549 1555 { 1550 1556 struct inode *inode = filp->f_dentry->d_inode; 1551 1557 struct cache_detail *cd = RPC_I(inode)->private; 1552 - long ret; 1553 1558 1554 - lock_kernel(); 1555 - ret = cache_ioctl(inode, filp, cmd, arg, cd); 1556 - unlock_kernel(); 1557 - 1558 - return ret; 1559 + return cache_ioctl(inode, filp, cmd, arg, cd); 1559 1560 } 1560 1561 1561 1562 static int cache_open_pipefs(struct inode *inode, struct file *filp)
+9 -17
net/sunrpc/rpc_pipe.c
··· 27 27 #include <linux/workqueue.h> 28 28 #include <linux/sunrpc/rpc_pipe_fs.h> 29 29 #include <linux/sunrpc/cache.h> 30 - #include <linux/smp_lock.h> 31 30 32 31 static struct vfsmount *rpc_mount __read_mostly; 33 32 static int rpc_mount_count; ··· 308 309 return mask; 309 310 } 310 311 311 - static int 312 - rpc_pipe_ioctl_unlocked(struct file *filp, unsigned int cmd, unsigned long arg) 312 + static long 313 + rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 313 314 { 314 - struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); 315 + struct inode *inode = filp->f_path.dentry->d_inode; 316 + struct rpc_inode *rpci = RPC_I(inode); 315 317 int len; 316 318 317 319 switch (cmd) { 318 320 case FIONREAD: 319 - if (rpci->ops == NULL) 321 + spin_lock(&inode->i_lock); 322 + if (rpci->ops == NULL) { 323 + spin_unlock(&inode->i_lock); 320 324 return -EPIPE; 325 + } 321 326 len = rpci->pipelen; 322 327 if (filp->private_data) { 323 328 struct rpc_pipe_msg *msg; 324 329 msg = (struct rpc_pipe_msg *)filp->private_data; 325 330 len += msg->len - msg->copied; 326 331 } 332 + spin_unlock(&inode->i_lock); 327 333 return put_user(len, (int __user *)arg); 328 334 default: 329 335 return -EINVAL; 330 336 } 331 - } 332 - 333 - static long 334 - rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 335 - { 336 - long ret; 337 - 338 - lock_kernel(); 339 - ret = rpc_pipe_ioctl_unlocked(filp, cmd, arg); 340 - unlock_kernel(); 341 - 342 - return ret; 343 337 } 344 338 345 339 static const struct file_operations rpc_pipe_fops = {
+1
net/x25/Kconfig
··· 5 5 config X25 6 6 tristate "CCITT X.25 Packet Layer (EXPERIMENTAL)" 7 7 depends on EXPERIMENTAL 8 + depends on BKL # should be fixable 8 9 ---help--- 9 10 X.25 is a set of standardized network protocols, similar in scope to 10 11 frame relay; the one physical line from your box to the X.25 network