diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-04-26 18:24:01 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-05-16 23:27:04 -0400 |
commit | f4927c45beda9a70e5c3bda0bd9f12b4f713c00b (patch) | |
tree | 18256d3dd635e931838e3d83b071ca5a1e61a163 /drivers/scsi | |
parent | 16ef8def80ea97c3cacdcaa765bdf62b2d94f86d (diff) |
scsi: Push down BKL into ioctl functions
Push down the bkl into ioctl functions on the scsi layer.
[jkacur: Forward declaration missing ';'.
Conflicting declaraction in megaraid.h changed
Fixed missing inodes declarations]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/3w-9xxx.c | 10 | ||||
-rw-r--r-- | drivers/scsi/3w-sas.c | 8 | ||||
-rw-r--r-- | drivers/scsi/3w-xxxx.c | 11 | ||||
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 11 | ||||
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 20 | ||||
-rw-r--r-- | drivers/scsi/gdth.c | 20 | ||||
-rw-r--r-- | drivers/scsi/megaraid.c | 20 | ||||
-rw-r--r-- | drivers/scsi/megaraid.h | 3 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_mm.c | 22 | ||||
-rw-r--r-- | drivers/scsi/osst.c | 14 | ||||
-rw-r--r-- | drivers/scsi/sg.c | 17 |
11 files changed, 120 insertions, 36 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index e9788f55ab13..4f74850560fe 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -123,7 +123,7 @@ static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_H | |||
123 | static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id); | 123 | static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id); |
124 | static char *twa_aen_severity_lookup(unsigned char severity_code); | 124 | static char *twa_aen_severity_lookup(unsigned char severity_code); |
125 | static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id); | 125 | static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id); |
126 | static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); | 126 | static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
127 | static int twa_chrdev_open(struct inode *inode, struct file *file); | 127 | static int twa_chrdev_open(struct inode *inode, struct file *file); |
128 | static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host); | 128 | static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_sense, int print_host); |
129 | static void twa_free_request_id(TW_Device_Extension *tw_dev,int request_id); | 129 | static void twa_free_request_id(TW_Device_Extension *tw_dev,int request_id); |
@@ -218,7 +218,7 @@ static struct device_attribute *twa_host_attrs[] = { | |||
218 | /* File operations struct for character device */ | 218 | /* File operations struct for character device */ |
219 | static const struct file_operations twa_fops = { | 219 | static const struct file_operations twa_fops = { |
220 | .owner = THIS_MODULE, | 220 | .owner = THIS_MODULE, |
221 | .ioctl = twa_chrdev_ioctl, | 221 | .unlocked_ioctl = twa_chrdev_ioctl, |
222 | .open = twa_chrdev_open, | 222 | .open = twa_chrdev_open, |
223 | .release = NULL | 223 | .release = NULL |
224 | }; | 224 | }; |
@@ -635,8 +635,9 @@ out: | |||
635 | } /* End twa_check_srl() */ | 635 | } /* End twa_check_srl() */ |
636 | 636 | ||
637 | /* This function handles ioctl for the character device */ | 637 | /* This function handles ioctl for the character device */ |
638 | static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | 638 | static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
639 | { | 639 | { |
640 | struct inode *inode = file->f_path.dentry->d_inode; | ||
640 | long timeout; | 641 | long timeout; |
641 | unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0; | 642 | unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0; |
642 | dma_addr_t dma_handle; | 643 | dma_addr_t dma_handle; |
@@ -655,6 +656,8 @@ static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int | |||
655 | int retval = TW_IOCTL_ERROR_OS_EFAULT; | 656 | int retval = TW_IOCTL_ERROR_OS_EFAULT; |
656 | void __user *argp = (void __user *)arg; | 657 | void __user *argp = (void __user *)arg; |
657 | 658 | ||
659 | lock_kernel(); | ||
660 | |||
658 | /* Only let one of these through at a time */ | 661 | /* Only let one of these through at a time */ |
659 | if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { | 662 | if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { |
660 | retval = TW_IOCTL_ERROR_OS_EINTR; | 663 | retval = TW_IOCTL_ERROR_OS_EINTR; |
@@ -874,6 +877,7 @@ out3: | |||
874 | out2: | 877 | out2: |
875 | mutex_unlock(&tw_dev->ioctl_lock); | 878 | mutex_unlock(&tw_dev->ioctl_lock); |
876 | out: | 879 | out: |
880 | unlock_kernel(); | ||
877 | return retval; | 881 | return retval; |
878 | } /* End twa_chrdev_ioctl() */ | 882 | } /* End twa_chrdev_ioctl() */ |
879 | 883 | ||
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c index 54c5ffb1eaa1..8af380951f17 100644 --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c | |||
@@ -750,19 +750,22 @@ static void twl_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm | |||
750 | 750 | ||
751 | /* This function handles ioctl for the character device | 751 | /* This function handles ioctl for the character device |
752 | This interface is used by smartmontools open source software */ | 752 | This interface is used by smartmontools open source software */ |
753 | static int twl_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | 753 | static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
754 | { | 754 | { |
755 | long timeout; | 755 | long timeout; |
756 | unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0; | 756 | unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0; |
757 | dma_addr_t dma_handle; | 757 | dma_addr_t dma_handle; |
758 | int request_id = 0; | 758 | int request_id = 0; |
759 | TW_Ioctl_Driver_Command driver_command; | 759 | TW_Ioctl_Driver_Command driver_command; |
760 | struct inode *inode = file->f_dentry->d_inode; | ||
760 | TW_Ioctl_Buf_Apache *tw_ioctl; | 761 | TW_Ioctl_Buf_Apache *tw_ioctl; |
761 | TW_Command_Full *full_command_packet; | 762 | TW_Command_Full *full_command_packet; |
762 | TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)]; | 763 | TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)]; |
763 | int retval = -EFAULT; | 764 | int retval = -EFAULT; |
764 | void __user *argp = (void __user *)arg; | 765 | void __user *argp = (void __user *)arg; |
765 | 766 | ||
767 | lock_kernel(); | ||
768 | |||
766 | /* Only let one of these through at a time */ | 769 | /* Only let one of these through at a time */ |
767 | if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { | 770 | if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { |
768 | retval = -EINTR; | 771 | retval = -EINTR; |
@@ -858,6 +861,7 @@ out3: | |||
858 | out2: | 861 | out2: |
859 | mutex_unlock(&tw_dev->ioctl_lock); | 862 | mutex_unlock(&tw_dev->ioctl_lock); |
860 | out: | 863 | out: |
864 | unlock_kernel(); | ||
861 | return retval; | 865 | return retval; |
862 | } /* End twl_chrdev_ioctl() */ | 866 | } /* End twl_chrdev_ioctl() */ |
863 | 867 | ||
@@ -884,7 +888,7 @@ out: | |||
884 | /* File operations struct for character device */ | 888 | /* File operations struct for character device */ |
885 | static const struct file_operations twl_fops = { | 889 | static const struct file_operations twl_fops = { |
886 | .owner = THIS_MODULE, | 890 | .owner = THIS_MODULE, |
887 | .ioctl = twl_chrdev_ioctl, | 891 | .unlocked_ioctl = twl_chrdev_ioctl, |
888 | .open = twl_chrdev_open, | 892 | .open = twl_chrdev_open, |
889 | .release = NULL | 893 | .release = NULL |
890 | }; | 894 | }; |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 5faf903ca8c8..608f3b28b25e 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -880,7 +880,7 @@ static int tw_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) | |||
880 | } /* End tw_allocate_memory() */ | 880 | } /* End tw_allocate_memory() */ |
881 | 881 | ||
882 | /* This function handles ioctl for the character device */ | 882 | /* This function handles ioctl for the character device */ |
883 | static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | 883 | static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
884 | { | 884 | { |
885 | int request_id; | 885 | int request_id; |
886 | dma_addr_t dma_handle; | 886 | dma_addr_t dma_handle; |
@@ -888,6 +888,7 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int | |||
888 | unsigned long flags; | 888 | unsigned long flags; |
889 | unsigned int data_buffer_length = 0; | 889 | unsigned int data_buffer_length = 0; |
890 | unsigned long data_buffer_length_adjusted = 0; | 890 | unsigned long data_buffer_length_adjusted = 0; |
891 | struct inode *inode = file->f_dentry->d_inode; | ||
891 | unsigned long *cpu_addr; | 892 | unsigned long *cpu_addr; |
892 | long timeout; | 893 | long timeout; |
893 | TW_New_Ioctl *tw_ioctl; | 894 | TW_New_Ioctl *tw_ioctl; |
@@ -898,9 +899,12 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int | |||
898 | 899 | ||
899 | dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n"); | 900 | dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n"); |
900 | 901 | ||
902 | lock_kernel(); | ||
901 | /* Only let one of these through at a time */ | 903 | /* Only let one of these through at a time */ |
902 | if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) | 904 | if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) { |
905 | unlock_kernel(); | ||
903 | return -EINTR; | 906 | return -EINTR; |
907 | } | ||
904 | 908 | ||
905 | /* First copy down the buffer length */ | 909 | /* First copy down the buffer length */ |
906 | if (copy_from_user(&data_buffer_length, argp, sizeof(unsigned int))) | 910 | if (copy_from_user(&data_buffer_length, argp, sizeof(unsigned int))) |
@@ -1029,6 +1033,7 @@ out2: | |||
1029 | dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle); | 1033 | dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle); |
1030 | out: | 1034 | out: |
1031 | mutex_unlock(&tw_dev->ioctl_lock); | 1035 | mutex_unlock(&tw_dev->ioctl_lock); |
1036 | unlock_kernel(); | ||
1032 | return retval; | 1037 | return retval; |
1033 | } /* End tw_chrdev_ioctl() */ | 1038 | } /* End tw_chrdev_ioctl() */ |
1034 | 1039 | ||
@@ -1051,7 +1056,7 @@ static int tw_chrdev_open(struct inode *inode, struct file *file) | |||
1051 | /* File operations struct for character device */ | 1056 | /* File operations struct for character device */ |
1052 | static const struct file_operations tw_fops = { | 1057 | static const struct file_operations tw_fops = { |
1053 | .owner = THIS_MODULE, | 1058 | .owner = THIS_MODULE, |
1054 | .ioctl = tw_chrdev_ioctl, | 1059 | .unlocked_ioctl = tw_chrdev_ioctl, |
1055 | .open = tw_chrdev_open, | 1060 | .open = tw_chrdev_open, |
1056 | .release = NULL | 1061 | .release = NULL |
1057 | }; | 1062 | }; |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index e9373a2d14fa..33898b61fdb5 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -705,12 +705,17 @@ static int aac_cfg_open(struct inode *inode, struct file *file) | |||
705 | * Bugs: Needs to handle hot plugging | 705 | * Bugs: Needs to handle hot plugging |
706 | */ | 706 | */ |
707 | 707 | ||
708 | static int aac_cfg_ioctl(struct inode *inode, struct file *file, | 708 | static long aac_cfg_ioctl(struct file *file, |
709 | unsigned int cmd, unsigned long arg) | 709 | unsigned int cmd, unsigned long arg) |
710 | { | 710 | { |
711 | int ret; | ||
711 | if (!capable(CAP_SYS_RAWIO)) | 712 | if (!capable(CAP_SYS_RAWIO)) |
712 | return -EPERM; | 713 | return -EPERM; |
713 | return aac_do_ioctl(file->private_data, cmd, (void __user *)arg); | 714 | lock_kernel(); |
715 | ret = aac_do_ioctl(file->private_data, cmd, (void __user *)arg); | ||
716 | unlock_kernel(); | ||
717 | |||
718 | return ret; | ||
714 | } | 719 | } |
715 | 720 | ||
716 | #ifdef CONFIG_COMPAT | 721 | #ifdef CONFIG_COMPAT |
@@ -1029,7 +1034,7 @@ ssize_t aac_get_serial_number(struct device *device, char *buf) | |||
1029 | 1034 | ||
1030 | static const struct file_operations aac_cfg_fops = { | 1035 | static const struct file_operations aac_cfg_fops = { |
1031 | .owner = THIS_MODULE, | 1036 | .owner = THIS_MODULE, |
1032 | .ioctl = aac_cfg_ioctl, | 1037 | .unlocked_ioctl = aac_cfg_ioctl, |
1033 | #ifdef CONFIG_COMPAT | 1038 | #ifdef CONFIG_COMPAT |
1034 | .compat_ioctl = aac_compat_cfg_ioctl, | 1039 | .compat_ioctl = aac_compat_cfg_ioctl, |
1035 | #endif | 1040 | #endif |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 0435d044c9da..b0c576f84b28 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -114,12 +114,13 @@ static int hba_count = 0; | |||
114 | 114 | ||
115 | static struct class *adpt_sysfs_class; | 115 | static struct class *adpt_sysfs_class; |
116 | 116 | ||
117 | static long adpt_unlocked_ioctl(struct file *, unsigned int, unsigned long); | ||
117 | #ifdef CONFIG_COMPAT | 118 | #ifdef CONFIG_COMPAT |
118 | static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long); | 119 | static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long); |
119 | #endif | 120 | #endif |
120 | 121 | ||
121 | static const struct file_operations adpt_fops = { | 122 | static const struct file_operations adpt_fops = { |
122 | .ioctl = adpt_ioctl, | 123 | .unlocked_ioctl = adpt_unlocked_ioctl, |
123 | .open = adpt_open, | 124 | .open = adpt_open, |
124 | .release = adpt_close, | 125 | .release = adpt_close, |
125 | #ifdef CONFIG_COMPAT | 126 | #ifdef CONFIG_COMPAT |
@@ -2069,8 +2070,7 @@ static int adpt_system_info(void __user *buffer) | |||
2069 | return 0; | 2070 | return 0; |
2070 | } | 2071 | } |
2071 | 2072 | ||
2072 | static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, | 2073 | static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) |
2073 | ulong arg) | ||
2074 | { | 2074 | { |
2075 | int minor; | 2075 | int minor; |
2076 | int error = 0; | 2076 | int error = 0; |
@@ -2153,6 +2153,20 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, | |||
2153 | return error; | 2153 | return error; |
2154 | } | 2154 | } |
2155 | 2155 | ||
2156 | static long adpt_unlocked_ioctl(struct file *file, uint cmd, ulong arg) | ||
2157 | { | ||
2158 | struct inode *inode; | ||
2159 | long ret; | ||
2160 | |||
2161 | inode = file->f_dentry->d_inode; | ||
2162 | |||
2163 | lock_kernel(); | ||
2164 | ret = adpt_ioctl(inode, file, cmd, arg); | ||
2165 | unlock_kernel(); | ||
2166 | |||
2167 | return ret; | ||
2168 | } | ||
2169 | |||
2156 | #ifdef CONFIG_COMPAT | 2170 | #ifdef CONFIG_COMPAT |
2157 | static long compat_adpt_ioctl(struct file *file, | 2171 | static long compat_adpt_ioctl(struct file *file, |
2158 | unsigned int cmd, unsigned long arg) | 2172 | unsigned int cmd, unsigned long arg) |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 35a4b3073ec3..d3f335db3d8d 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -180,8 +180,8 @@ static const char *gdth_ctr_name(gdth_ha_str *ha); | |||
180 | 180 | ||
181 | static int gdth_open(struct inode *inode, struct file *filep); | 181 | static int gdth_open(struct inode *inode, struct file *filep); |
182 | static int gdth_close(struct inode *inode, struct file *filep); | 182 | static int gdth_close(struct inode *inode, struct file *filep); |
183 | static int gdth_ioctl(struct inode *inode, struct file *filep, | 183 | static long gdth_unlocked_ioctl(struct file *filep, unsigned int cmd, |
184 | unsigned int cmd, unsigned long arg); | 184 | unsigned long arg); |
185 | 185 | ||
186 | static void gdth_flush(gdth_ha_str *ha); | 186 | static void gdth_flush(gdth_ha_str *ha); |
187 | static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)); | 187 | static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)); |
@@ -369,7 +369,7 @@ MODULE_LICENSE("GPL"); | |||
369 | 369 | ||
370 | /* ioctl interface */ | 370 | /* ioctl interface */ |
371 | static const struct file_operations gdth_fops = { | 371 | static const struct file_operations gdth_fops = { |
372 | .ioctl = gdth_ioctl, | 372 | .unlocked_ioctl = gdth_unlocked_ioctl, |
373 | .open = gdth_open, | 373 | .open = gdth_open, |
374 | .release = gdth_close, | 374 | .release = gdth_close, |
375 | }; | 375 | }; |
@@ -4462,8 +4462,7 @@ free_fail: | |||
4462 | return rc; | 4462 | return rc; |
4463 | } | 4463 | } |
4464 | 4464 | ||
4465 | static int gdth_ioctl(struct inode *inode, struct file *filep, | 4465 | static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) |
4466 | unsigned int cmd, unsigned long arg) | ||
4467 | { | 4466 | { |
4468 | gdth_ha_str *ha; | 4467 | gdth_ha_str *ha; |
4469 | Scsi_Cmnd *scp; | 4468 | Scsi_Cmnd *scp; |
@@ -4611,6 +4610,17 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, | |||
4611 | return 0; | 4610 | return 0; |
4612 | } | 4611 | } |
4613 | 4612 | ||
4613 | static long gdth_unlocked_ioctl(struct file *file, unsigned int cmd, | ||
4614 | unsigned long arg) | ||
4615 | { | ||
4616 | int ret; | ||
4617 | |||
4618 | lock_kernel(); | ||
4619 | ret = gdth_ioctl(file, cmd, arg); | ||
4620 | unlock_kernel(); | ||
4621 | |||
4622 | return ret; | ||
4623 | } | ||
4614 | 4624 | ||
4615 | /* flush routine */ | 4625 | /* flush routine */ |
4616 | static void gdth_flush(gdth_ha_str *ha) | 4626 | static void gdth_flush(gdth_ha_str *ha) |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 4bf7edca9e69..0b6e3228610a 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -91,12 +91,15 @@ static struct proc_dir_entry *mega_proc_dir_entry; | |||
91 | /* For controller re-ordering */ | 91 | /* For controller re-ordering */ |
92 | static struct mega_hbas mega_hbas[MAX_CONTROLLERS]; | 92 | static struct mega_hbas mega_hbas[MAX_CONTROLLERS]; |
93 | 93 | ||
94 | static long | ||
95 | megadev_unlocked_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | ||
96 | |||
94 | /* | 97 | /* |
95 | * The File Operations structure for the serial/ioctl interface of the driver | 98 | * The File Operations structure for the serial/ioctl interface of the driver |
96 | */ | 99 | */ |
97 | static const struct file_operations megadev_fops = { | 100 | static const struct file_operations megadev_fops = { |
98 | .owner = THIS_MODULE, | 101 | .owner = THIS_MODULE, |
99 | .ioctl = megadev_ioctl, | 102 | .unlocked_ioctl = megadev_unlocked_ioctl, |
100 | .open = megadev_open, | 103 | .open = megadev_open, |
101 | }; | 104 | }; |
102 | 105 | ||
@@ -3302,8 +3305,7 @@ megadev_open (struct inode *inode, struct file *filep) | |||
3302 | * controller. | 3305 | * controller. |
3303 | */ | 3306 | */ |
3304 | static int | 3307 | static int |
3305 | megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, | 3308 | megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) |
3306 | unsigned long arg) | ||
3307 | { | 3309 | { |
3308 | adapter_t *adapter; | 3310 | adapter_t *adapter; |
3309 | nitioctl_t uioc; | 3311 | nitioctl_t uioc; |
@@ -3694,6 +3696,18 @@ freemem_and_return: | |||
3694 | return 0; | 3696 | return 0; |
3695 | } | 3697 | } |
3696 | 3698 | ||
3699 | static long | ||
3700 | megadev_unlocked_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) | ||
3701 | { | ||
3702 | int ret; | ||
3703 | |||
3704 | lock_kernel(); | ||
3705 | ret = megadev_ioctl(filep, cmd, arg); | ||
3706 | unlock_kernel(); | ||
3707 | |||
3708 | return ret; | ||
3709 | } | ||
3710 | |||
3697 | /** | 3711 | /** |
3698 | * mega_m_to_n() | 3712 | * mega_m_to_n() |
3699 | * @arg - user address | 3713 | * @arg - user address |
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h index d310f49d077e..2b4a048cadf1 100644 --- a/drivers/scsi/megaraid.h +++ b/drivers/scsi/megaraid.h | |||
@@ -1013,8 +1013,7 @@ static void mega_8_to_40ld (mraid_inquiry *inquiry, | |||
1013 | mega_inquiry3 *enquiry3, mega_product_info *); | 1013 | mega_inquiry3 *enquiry3, mega_product_info *); |
1014 | 1014 | ||
1015 | static int megadev_open (struct inode *, struct file *); | 1015 | static int megadev_open (struct inode *, struct file *); |
1016 | static int megadev_ioctl (struct inode *, struct file *, unsigned int, | 1016 | static int megadev_ioctl (struct file *, unsigned int, unsigned long); |
1017 | unsigned long); | ||
1018 | static int mega_m_to_n(void __user *, nitioctl_t *); | 1017 | static int mega_m_to_n(void __user *, nitioctl_t *); |
1019 | static int mega_n_to_m(void __user *, megacmd_t *); | 1018 | static int mega_n_to_m(void __user *, megacmd_t *); |
1020 | 1019 | ||
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index 36e0b7d05c1d..41f82f76d884 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | // Entry points for char node driver | 23 | // Entry points for char node driver |
24 | static int mraid_mm_open(struct inode *, struct file *); | 24 | static int mraid_mm_open(struct inode *, struct file *); |
25 | static int mraid_mm_ioctl(struct inode *, struct file *, uint, unsigned long); | 25 | static long mraid_mm_unlocked_ioctl(struct file *, uint, unsigned long); |
26 | 26 | ||
27 | 27 | ||
28 | // routines to convert to and from the old the format | 28 | // routines to convert to and from the old the format |
@@ -70,7 +70,7 @@ static wait_queue_head_t wait_q; | |||
70 | 70 | ||
71 | static const struct file_operations lsi_fops = { | 71 | static const struct file_operations lsi_fops = { |
72 | .open = mraid_mm_open, | 72 | .open = mraid_mm_open, |
73 | .ioctl = mraid_mm_ioctl, | 73 | .unlocked_ioctl = mraid_mm_unlocked_ioctl, |
74 | #ifdef CONFIG_COMPAT | 74 | #ifdef CONFIG_COMPAT |
75 | .compat_ioctl = mraid_mm_compat_ioctl, | 75 | .compat_ioctl = mraid_mm_compat_ioctl, |
76 | #endif | 76 | #endif |
@@ -110,8 +110,7 @@ mraid_mm_open(struct inode *inode, struct file *filep) | |||
110 | * @arg : user ioctl packet | 110 | * @arg : user ioctl packet |
111 | */ | 111 | */ |
112 | static int | 112 | static int |
113 | mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, | 113 | mraid_mm_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) |
114 | unsigned long arg) | ||
115 | { | 114 | { |
116 | uioc_t *kioc; | 115 | uioc_t *kioc; |
117 | char signature[EXT_IOCTL_SIGN_SZ] = {0}; | 116 | char signature[EXT_IOCTL_SIGN_SZ] = {0}; |
@@ -218,6 +217,19 @@ mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, | |||
218 | return rval; | 217 | return rval; |
219 | } | 218 | } |
220 | 219 | ||
220 | static long | ||
221 | mraid_mm_unlocked_ioctl(struct file *filep, unsigned int cmd, | ||
222 | unsigned long arg) | ||
223 | { | ||
224 | int err; | ||
225 | |||
226 | /* inconsistant: mraid_mm_compat_ioctl doesn't take the BKL */ | ||
227 | lock_kernel(); | ||
228 | err = mraid_mm_ioctl(filep, cmd, arg); | ||
229 | unlock_kernel(); | ||
230 | |||
231 | return err; | ||
232 | } | ||
221 | 233 | ||
222 | /** | 234 | /** |
223 | * mraid_mm_get_adapter - Returns corresponding adapters for the mimd packet | 235 | * mraid_mm_get_adapter - Returns corresponding adapters for the mimd packet |
@@ -1225,7 +1237,7 @@ mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd, | |||
1225 | { | 1237 | { |
1226 | int err; | 1238 | int err; |
1227 | 1239 | ||
1228 | err = mraid_mm_ioctl(NULL, filep, cmd, arg); | 1240 | err = mraid_mm_ioctl(filep, cmd, arg); |
1229 | 1241 | ||
1230 | return err; | 1242 | return err; |
1231 | } | 1243 | } |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index b219118f8bd6..8dbf1c3afb7b 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -4932,7 +4932,7 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp) | |||
4932 | 4932 | ||
4933 | 4933 | ||
4934 | /* The ioctl command */ | 4934 | /* The ioctl command */ |
4935 | static int osst_ioctl(struct inode * inode,struct file * file, | 4935 | static long osst_ioctl(struct file * file, |
4936 | unsigned int cmd_in, unsigned long arg) | 4936 | unsigned int cmd_in, unsigned long arg) |
4937 | { | 4937 | { |
4938 | int i, cmd_nr, cmd_type, blk, retval = 0; | 4938 | int i, cmd_nr, cmd_type, blk, retval = 0; |
@@ -4943,8 +4943,11 @@ static int osst_ioctl(struct inode * inode,struct file * file, | |||
4943 | char * name = tape_name(STp); | 4943 | char * name = tape_name(STp); |
4944 | void __user * p = (void __user *)arg; | 4944 | void __user * p = (void __user *)arg; |
4945 | 4945 | ||
4946 | if (mutex_lock_interruptible(&STp->lock)) | 4946 | lock_kernel(); |
4947 | if (mutex_lock_interruptible(&STp->lock)) { | ||
4948 | unlock_kernel(); | ||
4947 | return -ERESTARTSYS; | 4949 | return -ERESTARTSYS; |
4950 | } | ||
4948 | 4951 | ||
4949 | #if DEBUG | 4952 | #if DEBUG |
4950 | if (debugging && !STp->in_use) { | 4953 | if (debugging && !STp->in_use) { |
@@ -5256,12 +5259,15 @@ static int osst_ioctl(struct inode * inode,struct file * file, | |||
5256 | 5259 | ||
5257 | mutex_unlock(&STp->lock); | 5260 | mutex_unlock(&STp->lock); |
5258 | 5261 | ||
5259 | return scsi_ioctl(STp->device, cmd_in, p); | 5262 | retval = scsi_ioctl(STp->device, cmd_in, p); |
5263 | unlock_kernel(); | ||
5264 | return retval; | ||
5260 | 5265 | ||
5261 | out: | 5266 | out: |
5262 | if (SRpnt) osst_release_request(SRpnt); | 5267 | if (SRpnt) osst_release_request(SRpnt); |
5263 | 5268 | ||
5264 | mutex_unlock(&STp->lock); | 5269 | mutex_unlock(&STp->lock); |
5270 | unlock_kernel(); | ||
5265 | 5271 | ||
5266 | return retval; | 5272 | return retval; |
5267 | } | 5273 | } |
@@ -5613,7 +5619,7 @@ static const struct file_operations osst_fops = { | |||
5613 | .owner = THIS_MODULE, | 5619 | .owner = THIS_MODULE, |
5614 | .read = osst_read, | 5620 | .read = osst_read, |
5615 | .write = osst_write, | 5621 | .write = osst_write, |
5616 | .ioctl = osst_ioctl, | 5622 | .unlocked_ioctl = osst_ioctl, |
5617 | #ifdef CONFIG_COMPAT | 5623 | #ifdef CONFIG_COMPAT |
5618 | .compat_ioctl = osst_compat_ioctl, | 5624 | .compat_ioctl = osst_compat_ioctl, |
5619 | #endif | 5625 | #endif |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index dee1c96288d4..ef752b248c4d 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -758,8 +758,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, | |||
758 | } | 758 | } |
759 | 759 | ||
760 | static int | 760 | static int |
761 | sg_ioctl(struct inode *inode, struct file *filp, | 761 | sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) |
762 | unsigned int cmd_in, unsigned long arg) | ||
763 | { | 762 | { |
764 | void __user *p = (void __user *)arg; | 763 | void __user *p = (void __user *)arg; |
765 | int __user *ip = p; | 764 | int __user *ip = p; |
@@ -1078,6 +1077,18 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
1078 | } | 1077 | } |
1079 | } | 1078 | } |
1080 | 1079 | ||
1080 | static long | ||
1081 | sg_unlocked_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) | ||
1082 | { | ||
1083 | int ret; | ||
1084 | |||
1085 | lock_kernel(); | ||
1086 | ret = sg_ioctl(filp, cmd_in, arg); | ||
1087 | unlock_kernel(); | ||
1088 | |||
1089 | return ret; | ||
1090 | } | ||
1091 | |||
1081 | #ifdef CONFIG_COMPAT | 1092 | #ifdef CONFIG_COMPAT |
1082 | static long sg_compat_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) | 1093 | static long sg_compat_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) |
1083 | { | 1094 | { |
@@ -1322,7 +1333,7 @@ static const struct file_operations sg_fops = { | |||
1322 | .read = sg_read, | 1333 | .read = sg_read, |
1323 | .write = sg_write, | 1334 | .write = sg_write, |
1324 | .poll = sg_poll, | 1335 | .poll = sg_poll, |
1325 | .ioctl = sg_ioctl, | 1336 | .unlocked_ioctl = sg_unlocked_ioctl, |
1326 | #ifdef CONFIG_COMPAT | 1337 | #ifdef CONFIG_COMPAT |
1327 | .compat_ioctl = sg_compat_ioctl, | 1338 | .compat_ioctl = sg_compat_ioctl, |
1328 | #endif | 1339 | #endif |