aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/char/cs5535_gpio.c4
-rw-r--r--drivers/char/dtlk.c5
-rw-r--r--drivers/char/ip2/ip2main.c34
-rw-r--r--drivers/char/pc8736x_gpio.c3
-rw-r--r--drivers/char/ppdev.c3
-rw-r--r--drivers/char/scx200_gpio.c3
-rw-r--r--drivers/char/tb0219.c3
-rw-r--r--drivers/char/vr41xx_giu.c4
-rw-r--r--drivers/infiniband/core/ucm.c3
-rw-r--r--drivers/infiniband/hw/ipath/ipath_file_ops.c3
-rw-r--r--drivers/isdn/hardware/eicon/divasi.c2
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c2
-rw-r--r--drivers/net/ppp_generic.c3
-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
17 files changed, 37 insertions, 52 deletions
diff --git a/drivers/char/cs5535_gpio.c b/drivers/char/cs5535_gpio.c
index 628e3d3249d2..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
@@ -153,12 +154,11 @@ static ssize_t cs5535_gpio_read(struct file *file, char __user *buf,
153 return count; 154 return count;
154} 155}
155 156
156/* No BKL needed here - "mask" is the only global resource used
157 here and it's a boot-time parameter */
158static int cs5535_gpio_open(struct inode *inode, struct file *file) 157static int cs5535_gpio_open(struct inode *inode, struct file *file)
159{ 158{
160 u32 m = iminor(inode); 159 u32 m = iminor(inode);
161 160
161 cycle_kernel_lock();
162 /* the mask says which pins are usable by this driver */ 162 /* the mask says which pins are usable by this driver */
163 if ((mask & (1 << m)) == 0) 163 if ((mask & (1 << m)) == 0)
164 return -EINVAL; 164 return -EINVAL;
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
index 433388c60235..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,12 +289,12 @@ static int dtlk_ioctl(struct inode *inode,
288 } 289 }
289} 290}
290 291
291/* No BKL needed here; "dtlk_busy" is the only global resource, 292/* Note that nobody ever sets dtlk_busy... */
292 and it is not ever set by anybody (test is broken) */
293static int dtlk_open(struct inode *inode, struct file *file) 293static int dtlk_open(struct inode *inode, struct file *file)
294{ 294{
295 TRACE_TEXT("(dtlk_open"); 295 TRACE_TEXT("(dtlk_open");
296 296
297 cycle_kernel_lock();
297 nonseekable_open(inode, file); 298 nonseekable_open(inode, file);
298 switch (iminor(inode)) { 299 switch (iminor(inode)) {
299 case DTLK_MINOR: 300 case DTLK_MINOR:
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 70957acaa960..a978c57b6b2b 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>
@@ -2931,42 +2932,11 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg )
2931static int 2932static int
2932ip2_ipl_open( struct inode *pInode, struct file *pFile ) 2933ip2_ipl_open( struct inode *pInode, struct file *pFile )
2933{ 2934{
2934 unsigned int iplminor = iminor(pInode);
2935 i2eBordStrPtr pB;
2936 i2ChanStrPtr pCh;
2937 2935
2938#ifdef IP2DEBUG_IPL 2936#ifdef IP2DEBUG_IPL
2939 printk (KERN_DEBUG "IP2IPL: open\n" ); 2937 printk (KERN_DEBUG "IP2IPL: open\n" );
2940#endif 2938#endif
2941 2939 cycle_kernel_lock();
2942 switch(iplminor) {
2943 // These are the IPL devices
2944 case 0:
2945 case 4:
2946 case 8:
2947 case 12:
2948 break;
2949
2950 // These are the status devices
2951 case 1:
2952 case 5:
2953 case 9:
2954 case 13:
2955 break;
2956
2957 // These are the debug devices
2958 case 2:
2959 case 6:
2960 case 10:
2961 case 14:
2962 pB = i2BoardPtrTable[iplminor / 4];
2963 pCh = (i2ChanStrPtr) pB->i2eChannelPtr;
2964 break;
2965
2966 // This is the trace device
2967 case 3:
2968 break;
2969 }
2970 return 0; 2940 return 0;
2971} 2941}
2972 2942
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
index 8715dc9f4a53..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"
@@ -212,12 +213,12 @@ static struct nsc_gpio_ops pc8736x_gpio_ops = {
212 .gpio_current = pc8736x_gpio_current 213 .gpio_current = pc8736x_gpio_current
213}; 214};
214 215
215/* No BKL needed here; no global resources accessed */
216static int pc8736x_gpio_open(struct inode *inode, struct file *file) 216static int pc8736x_gpio_open(struct inode *inode, struct file *file)
217{ 217{
218 unsigned m = iminor(inode); 218 unsigned m = iminor(inode);
219 file->private_data = &pc8736x_gpio_ops; 219 file->private_data = &pc8736x_gpio_ops;
220 220
221 cycle_kernel_lock();
221 dev_dbg(&pdev->dev, "open %d\n", m); 222 dev_dbg(&pdev->dev, "open %d\n", m);
222 223
223 if (m >= PC8736X_GPIO_CT) 224 if (m >= PC8736X_GPIO_CT)
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index ce1987574888..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"
@@ -633,12 +634,12 @@ static int pp_ioctl(struct inode *inode, struct file *file,
633 return 0; 634 return 0;
634} 635}
635 636
636/* No BKL needed here: only local resources used */
637static int pp_open (struct inode * inode, struct file * file) 637static int pp_open (struct inode * inode, struct file * file)
638{ 638{
639 unsigned int minor = iminor(inode); 639 unsigned int minor = iminor(inode);
640 struct pp_struct *pp; 640 struct pp_struct *pp;
641 641
642 cycle_kernel_lock();
642 if (minor >= PARPORT_MAX) 643 if (minor >= PARPORT_MAX)
643 return -ENXIO; 644 return -ENXIO;
644 645
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c
index be2c623a9862..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
@@ -46,12 +47,12 @@ struct nsc_gpio_ops scx200_gpio_ops = {
46}; 47};
47EXPORT_SYMBOL_GPL(scx200_gpio_ops); 48EXPORT_SYMBOL_GPL(scx200_gpio_ops);
48 49
49/* No BKL needed here: no global resources used */
50static int scx200_gpio_open(struct inode *inode, struct file *file) 50static int scx200_gpio_open(struct inode *inode, struct file *file)
51{ 51{
52 unsigned m = iminor(inode); 52 unsigned m = iminor(inode);
53 file->private_data = &scx200_gpio_ops; 53 file->private_data = &scx200_gpio_ops;
54 54
55 cycle_kernel_lock();
55 if (m >= MAX_PINS) 56 if (m >= MAX_PINS)
56 return -EINVAL; 57 return -EINVAL;
57 return nonseekable_open(inode, file); 58 return nonseekable_open(inode, file);
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c
index db8c2ca2ce4c..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>
@@ -232,11 +233,11 @@ static ssize_t tanbac_tb0219_write(struct file *file, const char __user *data,
232 return i; 233 return i;
233} 234}
234 235
235/* No BKL needed here; no global resources accessed */
236static int tanbac_tb0219_open(struct inode *inode, struct file *file) 236static int tanbac_tb0219_open(struct inode *inode, struct file *file)
237{ 237{
238 unsigned int minor; 238 unsigned int minor;
239 239
240 cycle_kernel_lock();
240 minor = iminor(inode); 241 minor = iminor(inode);
241 switch (minor) { 242 switch (minor) {
242 case 0: 243 case 0:
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c
index 412937fdb958..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
@@ -543,12 +544,11 @@ static ssize_t gpio_write(struct file *file, const char __user *data,
543 return i; 544 return i;
544} 545}
545 546
546/* No BKL needed here; only global (giu_nr_pins) is only set
547 at probe time */
548static int gpio_open(struct inode *inode, struct file *file) 547static int gpio_open(struct inode *inode, struct file *file)
549{ 548{
550 unsigned int pin; 549 unsigned int pin;
551 550
551 cycle_kernel_lock();
552 pin = iminor(inode); 552 pin = iminor(inode);
553 if (pin >= giu_nr_pins) 553 if (pin >= giu_nr_pins)
554 return -EBADF; 554 return -EBADF;
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index 3e6a8ff6d76c..b25675faaaf5 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -45,6 +45,7 @@
45#include <linux/cdev.h> 45#include <linux/cdev.h>
46#include <linux/idr.h> 46#include <linux/idr.h>
47#include <linux/mutex.h> 47#include <linux/mutex.h>
48#include <linux/smp_lock.h>
48 49
49#include <asm/uaccess.h> 50#include <asm/uaccess.h>
50 51
@@ -1155,11 +1156,11 @@ static unsigned int ib_ucm_poll(struct file *filp,
1155 return mask; 1156 return mask;
1156} 1157}
1157 1158
1158/* No BKL needed here: no global resources used */
1159static int ib_ucm_open(struct inode *inode, struct file *filp) 1159static int ib_ucm_open(struct inode *inode, struct file *filp)
1160{ 1160{
1161 struct ib_ucm_file *file; 1161 struct ib_ucm_file *file;
1162 1162
1163 cycle_kernel_lock();
1163 file = kmalloc(sizeof(*file), GFP_KERNEL); 1164 file = kmalloc(sizeof(*file), GFP_KERNEL);
1164 if (!file) 1165 if (!file)
1165 return -ENOMEM; 1166 return -ENOMEM;
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index e80cfbd4f3fd..35f301c88b57 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -39,6 +39,7 @@
39#include <linux/highmem.h> 39#include <linux/highmem.h>
40#include <linux/io.h> 40#include <linux/io.h>
41#include <linux/jiffies.h> 41#include <linux/jiffies.h>
42#include <linux/smp_lock.h>
42#include <asm/pgtable.h> 43#include <asm/pgtable.h>
43 44
44#include "ipath_kernel.h" 45#include "ipath_kernel.h"
@@ -1812,10 +1813,10 @@ done:
1812 return ret; 1813 return ret;
1813} 1814}
1814 1815
1815/* No BKL needed here */
1816static int ipath_open(struct inode *in, struct file *fp) 1816static int ipath_open(struct inode *in, struct file *fp)
1817{ 1817{
1818 /* The real work is performed later in ipath_assign_port() */ 1818 /* The real work is performed later in ipath_assign_port() */
1819 cycle_kernel_lock();
1819 fp->private_data = kzalloc(sizeof(struct ipath_filedata), GFP_KERNEL); 1820 fp->private_data = kzalloc(sizeof(struct ipath_filedata), GFP_KERNEL);
1820 return fp->private_data ? 0 : -ENOMEM; 1821 return fp->private_data ? 0 : -ENOMEM;
1821} 1822}
diff --git a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c
index 78f141e77466..f4969fe0a055 100644
--- a/drivers/isdn/hardware/eicon/divasi.c
+++ b/drivers/isdn/hardware/eicon/divasi.c
@@ -17,6 +17,7 @@
17#include <linux/poll.h> 17#include <linux/poll.h>
18#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
19#include <linux/skbuff.h> 19#include <linux/skbuff.h>
20#include <linux/smp_lock.h>
20#include <asm/uaccess.h> 21#include <asm/uaccess.h>
21 22
22#include "platform.h" 23#include "platform.h"
@@ -400,6 +401,7 @@ static unsigned int um_idi_poll(struct file *file, poll_table * wait)
400 401
401static int um_idi_open(struct inode *inode, struct file *file) 402static int um_idi_open(struct inode *inode, struct file *file)
402{ 403{
404 cycle_kernel_lock();
403 return (0); 405 return (0);
404} 406}
405 407
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index 5fcbdccd7a53..65c95019a9ae 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -21,6 +21,7 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/poll.h> 22#include <linux/poll.h>
23#include <linux/kmod.h> 23#include <linux/kmod.h>
24#include <linux/smp_lock.h>
24 25
25#include "platform.h" 26#include "platform.h"
26#undef ID_MASK 27#undef ID_MASK
@@ -580,6 +581,7 @@ xdi_copy_from_user(void *os_handle, void *dst, const void __user *src, int lengt
580 */ 581 */
581static int divas_open(struct inode *inode, struct file *file) 582static int divas_open(struct inode *inode, struct file *file)
582{ 583{
584 cycle_kernel_lock();
583 return (0); 585 return (0);
584} 586}
585 587
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index dc8505062da7..83625fdff3dd 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -39,6 +39,7 @@
39#include <linux/if_arp.h> 39#include <linux/if_arp.h>
40#include <linux/ip.h> 40#include <linux/ip.h>
41#include <linux/tcp.h> 41#include <linux/tcp.h>
42#include <linux/smp_lock.h>
42#include <linux/spinlock.h> 43#include <linux/spinlock.h>
43#include <linux/rwsem.h> 44#include <linux/rwsem.h>
44#include <linux/stddef.h> 45#include <linux/stddef.h>
@@ -351,9 +352,9 @@ static const int npindex_to_ethertype[NUM_NP] = {
351 * Open instances of /dev/ppp can be in one of three states: 352 * Open instances of /dev/ppp can be in one of three states:
352 * unattached, attached to a ppp unit, or attached to a ppp channel. 353 * unattached, attached to a ppp unit, or attached to a ppp channel.
353 */ 354 */
354/* No BKL needed here */
355static int ppp_open(struct inode *inode, struct file *file) 355static int ppp_open(struct inode *inode, struct file *file)
356{ 356{
357 cycle_kernel_lock();
357 /* 358 /*
358 * This could (should?) be enforced by the permissions on /dev/ppp. 359 * This could (should?) be enforced by the permissions on /dev/ppp.
359 */ 360 */
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 */