aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-18 17:32:43 -0400
committerJonathan Corbet <corbet@lwn.net>2008-06-20 16:05:53 -0400
commitf2b9857eee17797541b845782ade4d7a9d50f843 (patch)
tree914a00afee2ff953199f99f7cf869e3fd83b36bd /drivers/scsi
parent0b2806768899dba5967bcd4a3b93eaed9a1dc4f3 (diff)
Add a bunch of cycle_kernel_lock() calls
All of the open() functions which don't need the BKL on their face may still depend on its acquisition to serialize opens against driver initialization. So make those functions acquire then release the BKL to be on the safe side. Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/3w-9xxx.c5
-rw-r--r--drivers/scsi/3w-xxxx.c5
-rw-r--r--drivers/scsi/megaraid.c4
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c3
4 files changed, 10 insertions, 7 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 2239d16fb9b5..eaa805df5b00 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -84,6 +84,7 @@
84#include <linux/pci.h> 84#include <linux/pci.h>
85#include <linux/time.h> 85#include <linux/time.h>
86#include <linux/mutex.h> 86#include <linux/mutex.h>
87#include <linux/smp_lock.h>
87#include <asm/io.h> 88#include <asm/io.h>
88#include <asm/irq.h> 89#include <asm/irq.h>
89#include <asm/uaccess.h> 90#include <asm/uaccess.h>
@@ -862,13 +863,13 @@ out:
862} /* End twa_chrdev_ioctl() */ 863} /* End twa_chrdev_ioctl() */
863 864
864/* This function handles open for the character device */ 865/* This function handles open for the character device */
865/* NOTE that this function will race with remove; adding BKL 866/* NOTE that this function will race with remove. */
866 will not help. */
867static int twa_chrdev_open(struct inode *inode, struct file *file) 867static int twa_chrdev_open(struct inode *inode, struct file *file)
868{ 868{
869 unsigned int minor_number; 869 unsigned int minor_number;
870 int retval = TW_IOCTL_ERROR_OS_ENODEV; 870 int retval = TW_IOCTL_ERROR_OS_ENODEV;
871 871
872 cycle_kernel_lock();
872 minor_number = iminor(inode); 873 minor_number = iminor(inode);
873 if (minor_number >= twa_device_extension_count) 874 if (minor_number >= twa_device_extension_count)
874 goto out; 875 goto out;
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index bbff029536ea..a0537f09aa21 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -198,6 +198,7 @@
198 198
199#include <linux/module.h> 199#include <linux/module.h>
200#include <linux/reboot.h> 200#include <linux/reboot.h>
201#include <linux/smp_lock.h>
201#include <linux/spinlock.h> 202#include <linux/spinlock.h>
202#include <linux/interrupt.h> 203#include <linux/interrupt.h>
203#include <linux/moduleparam.h> 204#include <linux/moduleparam.h>
@@ -1027,12 +1028,12 @@ out:
1027} /* End tw_chrdev_ioctl() */ 1028} /* End tw_chrdev_ioctl() */
1028 1029
1029/* This function handles open for the character device */ 1030/* This function handles open for the character device */
1030/* NOTE that this function races with remove - adding BKL 1031/* NOTE that this function races with remove. */
1031 won't help */
1032static int tw_chrdev_open(struct inode *inode, struct file *file) 1032static int tw_chrdev_open(struct inode *inode, struct file *file)
1033{ 1033{
1034 unsigned int minor_number; 1034 unsigned int minor_number;
1035 1035
1036 cycle_kernel_lock();
1036 dprintk(KERN_WARNING "3w-xxxx: tw_ioctl_open()\n"); 1037 dprintk(KERN_WARNING "3w-xxxx: tw_ioctl_open()\n");
1037 1038
1038 minor_number = iminor(inode); 1039 minor_number = iminor(inode);
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index c9aa2c45a699..28c9da7d4a5c 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -46,6 +46,7 @@
46#include <linux/pci.h> 46#include <linux/pci.h>
47#include <linux/init.h> 47#include <linux/init.h>
48#include <linux/dma-mapping.h> 48#include <linux/dma-mapping.h>
49#include <linux/smp_lock.h>
49#include <scsi/scsicam.h> 50#include <scsi/scsicam.h>
50 51
51#include "scsi.h" 52#include "scsi.h"
@@ -3273,12 +3274,11 @@ mega_init_scb(adapter_t *adapter)
3273 * 3274 *
3274 * Routines for the character/ioctl interface to the driver. Find out if this 3275 * Routines for the character/ioctl interface to the driver. Find out if this
3275 * is a valid open. 3276 * is a valid open.
3276 *
3277 * No BKL needed here.
3278 */ 3277 */
3279static int 3278static int
3280megadev_open (struct inode *inode, struct file *filep) 3279megadev_open (struct inode *inode, struct file *filep)
3281{ 3280{
3281 cycle_kernel_lock();
3282 /* 3282 /*
3283 * Only allow superuser to access private ioctl interface 3283 * Only allow superuser to access private ioctl interface
3284 */ 3284 */
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 81374b7c555c..fc7ac158476c 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -33,6 +33,7 @@
33#include <linux/spinlock.h> 33#include <linux/spinlock.h>
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/smp_lock.h>
36#include <linux/uio.h> 37#include <linux/uio.h>
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
38#include <linux/fs.h> 39#include <linux/fs.h>
@@ -2860,10 +2861,10 @@ static void megasas_shutdown(struct pci_dev *pdev)
2860 2861
2861/** 2862/**
2862 * megasas_mgmt_open - char node "open" entry point 2863 * megasas_mgmt_open - char node "open" entry point
2863 * No BKL is needed here.
2864 */ 2864 */
2865static int megasas_mgmt_open(struct inode *inode, struct file *filep) 2865static int megasas_mgmt_open(struct inode *inode, struct file *filep)
2866{ 2866{
2867 cycle_kernel_lock();
2867 /* 2868 /*
2868 * Allow only those users with admin rights 2869 * Allow only those users with admin rights
2869 */ 2870 */