diff options
Diffstat (limited to 'drivers/message')
-rw-r--r-- | drivers/message/i2o/i2o_block.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index a5bc3ee0d93e..e6733bc99724 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -657,30 +657,40 @@ static int i2o_block_ioctl(struct block_device *bdev, fmode_t mode, | |||
657 | { | 657 | { |
658 | struct gendisk *disk = bdev->bd_disk; | 658 | struct gendisk *disk = bdev->bd_disk; |
659 | struct i2o_block_device *dev = disk->private_data; | 659 | struct i2o_block_device *dev = disk->private_data; |
660 | int ret = -ENOTTY; | ||
660 | 661 | ||
661 | /* Anyone capable of this syscall can do *real bad* things */ | 662 | /* Anyone capable of this syscall can do *real bad* things */ |
662 | 663 | ||
663 | if (!capable(CAP_SYS_ADMIN)) | 664 | if (!capable(CAP_SYS_ADMIN)) |
664 | return -EPERM; | 665 | return -EPERM; |
665 | 666 | ||
667 | lock_kernel(); | ||
666 | switch (cmd) { | 668 | switch (cmd) { |
667 | case BLKI2OGRSTRAT: | 669 | case BLKI2OGRSTRAT: |
668 | return put_user(dev->rcache, (int __user *)arg); | 670 | ret = put_user(dev->rcache, (int __user *)arg); |
671 | break; | ||
669 | case BLKI2OGWSTRAT: | 672 | case BLKI2OGWSTRAT: |
670 | return put_user(dev->wcache, (int __user *)arg); | 673 | ret = put_user(dev->wcache, (int __user *)arg); |
674 | break; | ||
671 | case BLKI2OSRSTRAT: | 675 | case BLKI2OSRSTRAT: |
676 | ret = -EINVAL; | ||
672 | if (arg < 0 || arg > CACHE_SMARTFETCH) | 677 | if (arg < 0 || arg > CACHE_SMARTFETCH) |
673 | return -EINVAL; | 678 | break; |
674 | dev->rcache = arg; | 679 | dev->rcache = arg; |
680 | ret = 0; | ||
675 | break; | 681 | break; |
676 | case BLKI2OSWSTRAT: | 682 | case BLKI2OSWSTRAT: |
683 | ret = -EINVAL; | ||
677 | if (arg != 0 | 684 | if (arg != 0 |
678 | && (arg < CACHE_WRITETHROUGH || arg > CACHE_SMARTBACK)) | 685 | && (arg < CACHE_WRITETHROUGH || arg > CACHE_SMARTBACK)) |
679 | return -EINVAL; | 686 | break; |
680 | dev->wcache = arg; | 687 | dev->wcache = arg; |
688 | ret = 0; | ||
681 | break; | 689 | break; |
682 | } | 690 | } |
683 | return -ENOTTY; | 691 | unlock_kernel(); |
692 | |||
693 | return ret; | ||
684 | }; | 694 | }; |
685 | 695 | ||
686 | /** | 696 | /** |
@@ -936,6 +946,7 @@ static const struct block_device_operations i2o_block_fops = { | |||
936 | .open = i2o_block_open, | 946 | .open = i2o_block_open, |
937 | .release = i2o_block_release, | 947 | .release = i2o_block_release, |
938 | .ioctl = i2o_block_ioctl, | 948 | .ioctl = i2o_block_ioctl, |
949 | .compat_ioctl = i2o_block_ioctl, | ||
939 | .getgeo = i2o_block_getgeo, | 950 | .getgeo = i2o_block_getgeo, |
940 | .media_changed = i2o_block_media_changed | 951 | .media_changed = i2o_block_media_changed |
941 | }; | 952 | }; |