diff options
Diffstat (limited to 'block/ioctl.c')
-rw-r--r-- | block/ioctl.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/block/ioctl.c b/block/ioctl.c index e8eb679f2f9b..09fd7f1ef23a 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -163,18 +163,10 @@ int __blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode, | |||
163 | unsigned cmd, unsigned long arg) | 163 | unsigned cmd, unsigned long arg) |
164 | { | 164 | { |
165 | struct gendisk *disk = bdev->bd_disk; | 165 | struct gendisk *disk = bdev->bd_disk; |
166 | int ret; | ||
167 | 166 | ||
168 | if (disk->fops->ioctl) | 167 | if (disk->fops->ioctl) |
169 | return disk->fops->ioctl(bdev, mode, cmd, arg); | 168 | return disk->fops->ioctl(bdev, mode, cmd, arg); |
170 | 169 | ||
171 | if (disk->fops->locked_ioctl) { | ||
172 | lock_kernel(); | ||
173 | ret = disk->fops->locked_ioctl(bdev, mode, cmd, arg); | ||
174 | unlock_kernel(); | ||
175 | return ret; | ||
176 | } | ||
177 | |||
178 | return -ENOTTY; | 170 | return -ENOTTY; |
179 | } | 171 | } |
180 | /* | 172 | /* |
@@ -185,8 +177,7 @@ int __blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode, | |||
185 | EXPORT_SYMBOL_GPL(__blkdev_driver_ioctl); | 177 | EXPORT_SYMBOL_GPL(__blkdev_driver_ioctl); |
186 | 178 | ||
187 | /* | 179 | /* |
188 | * always keep this in sync with compat_blkdev_ioctl() and | 180 | * always keep this in sync with compat_blkdev_ioctl() |
189 | * compat_blkdev_locked_ioctl() | ||
190 | */ | 181 | */ |
191 | int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | 182 | int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, |
192 | unsigned long arg) | 183 | unsigned long arg) |
@@ -206,10 +197,8 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
206 | if (ret != -EINVAL && ret != -ENOTTY) | 197 | if (ret != -EINVAL && ret != -ENOTTY) |
207 | return ret; | 198 | return ret; |
208 | 199 | ||
209 | lock_kernel(); | ||
210 | fsync_bdev(bdev); | 200 | fsync_bdev(bdev); |
211 | invalidate_bdev(bdev); | 201 | invalidate_bdev(bdev); |
212 | unlock_kernel(); | ||
213 | return 0; | 202 | return 0; |
214 | 203 | ||
215 | case BLKROSET: | 204 | case BLKROSET: |
@@ -221,9 +210,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
221 | return -EACCES; | 210 | return -EACCES; |
222 | if (get_user(n, (int __user *)(arg))) | 211 | if (get_user(n, (int __user *)(arg))) |
223 | return -EFAULT; | 212 | return -EFAULT; |
224 | lock_kernel(); | ||
225 | set_device_ro(bdev, n); | 213 | set_device_ro(bdev, n); |
226 | unlock_kernel(); | ||
227 | return 0; | 214 | return 0; |
228 | 215 | ||
229 | case BLKDISCARD: { | 216 | case BLKDISCARD: { |
@@ -309,14 +296,10 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
309 | bd_release(bdev); | 296 | bd_release(bdev); |
310 | return ret; | 297 | return ret; |
311 | case BLKPG: | 298 | case BLKPG: |
312 | lock_kernel(); | ||
313 | ret = blkpg_ioctl(bdev, (struct blkpg_ioctl_arg __user *) arg); | 299 | ret = blkpg_ioctl(bdev, (struct blkpg_ioctl_arg __user *) arg); |
314 | unlock_kernel(); | ||
315 | break; | 300 | break; |
316 | case BLKRRPART: | 301 | case BLKRRPART: |
317 | lock_kernel(); | ||
318 | ret = blkdev_reread_part(bdev); | 302 | ret = blkdev_reread_part(bdev); |
319 | unlock_kernel(); | ||
320 | break; | 303 | break; |
321 | case BLKGETSIZE: | 304 | case BLKGETSIZE: |
322 | size = bdev->bd_inode->i_size; | 305 | size = bdev->bd_inode->i_size; |
@@ -329,9 +312,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
329 | case BLKTRACESTOP: | 312 | case BLKTRACESTOP: |
330 | case BLKTRACESETUP: | 313 | case BLKTRACESETUP: |
331 | case BLKTRACETEARDOWN: | 314 | case BLKTRACETEARDOWN: |
332 | lock_kernel(); | ||
333 | ret = blk_trace_ioctl(bdev, cmd, (char __user *) arg); | 315 | ret = blk_trace_ioctl(bdev, cmd, (char __user *) arg); |
334 | unlock_kernel(); | ||
335 | break; | 316 | break; |
336 | default: | 317 | default: |
337 | ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg); | 318 | ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg); |