diff options
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r-- | drivers/scsi/sr.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 0a90abc7f140..d42fa6468f41 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/init.h> | 44 | #include <linux/init.h> |
45 | #include <linux/blkdev.h> | 45 | #include <linux/blkdev.h> |
46 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
47 | #include <linux/smp_lock.h> | ||
47 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
48 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
49 | 50 | ||
@@ -493,6 +494,8 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
493 | void __user *argp = (void __user *)arg; | 494 | void __user *argp = (void __user *)arg; |
494 | int ret; | 495 | int ret; |
495 | 496 | ||
497 | lock_kernel(); | ||
498 | |||
496 | /* | 499 | /* |
497 | * Send SCSI addressing ioctls directly to mid level, send other | 500 | * Send SCSI addressing ioctls directly to mid level, send other |
498 | * ioctls to cdrom/block level. | 501 | * ioctls to cdrom/block level. |
@@ -500,12 +503,13 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
500 | switch (cmd) { | 503 | switch (cmd) { |
501 | case SCSI_IOCTL_GET_IDLUN: | 504 | case SCSI_IOCTL_GET_IDLUN: |
502 | case SCSI_IOCTL_GET_BUS_NUMBER: | 505 | case SCSI_IOCTL_GET_BUS_NUMBER: |
503 | return scsi_ioctl(sdev, cmd, argp); | 506 | ret = scsi_ioctl(sdev, cmd, argp); |
507 | goto out; | ||
504 | } | 508 | } |
505 | 509 | ||
506 | ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg); | 510 | ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg); |
507 | if (ret != -ENOSYS) | 511 | if (ret != -ENOSYS) |
508 | return ret; | 512 | goto out; |
509 | 513 | ||
510 | /* | 514 | /* |
511 | * ENODEV means that we didn't recognise the ioctl, or that we | 515 | * ENODEV means that we didn't recognise the ioctl, or that we |
@@ -516,8 +520,12 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
516 | ret = scsi_nonblockable_ioctl(sdev, cmd, argp, | 520 | ret = scsi_nonblockable_ioctl(sdev, cmd, argp, |
517 | (mode & FMODE_NDELAY) != 0); | 521 | (mode & FMODE_NDELAY) != 0); |
518 | if (ret != -ENODEV) | 522 | if (ret != -ENODEV) |
519 | return ret; | 523 | goto out; |
520 | return scsi_ioctl(sdev, cmd, argp); | 524 | ret = scsi_ioctl(sdev, cmd, argp); |
525 | |||
526 | out: | ||
527 | unlock_kernel(); | ||
528 | return ret; | ||
521 | } | 529 | } |
522 | 530 | ||
523 | static int sr_block_media_changed(struct gendisk *disk) | 531 | static int sr_block_media_changed(struct gendisk *disk) |
@@ -531,7 +539,7 @@ static const struct block_device_operations sr_bdops = | |||
531 | .owner = THIS_MODULE, | 539 | .owner = THIS_MODULE, |
532 | .open = sr_block_open, | 540 | .open = sr_block_open, |
533 | .release = sr_block_release, | 541 | .release = sr_block_release, |
534 | .locked_ioctl = sr_block_ioctl, | 542 | .ioctl = sr_block_ioctl, |
535 | .media_changed = sr_block_media_changed, | 543 | .media_changed = sr_block_media_changed, |
536 | /* | 544 | /* |
537 | * No compat_ioctl for now because sr_block_ioctl never | 545 | * No compat_ioctl for now because sr_block_ioctl never |