aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/i2o/i2o_block.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index b8233ff863e3..d1bdf8abe5db 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -53,7 +53,6 @@
53#include <linux/module.h> 53#include <linux/module.h>
54#include <linux/slab.h> 54#include <linux/slab.h>
55#include <linux/i2o.h> 55#include <linux/i2o.h>
56#include <linux/smp_lock.h>
57 56
58#include <linux/mempool.h> 57#include <linux/mempool.h>
59 58
@@ -653,40 +652,30 @@ static int i2o_block_ioctl(struct block_device *bdev, fmode_t mode,
653{ 652{
654 struct gendisk *disk = bdev->bd_disk; 653 struct gendisk *disk = bdev->bd_disk;
655 struct i2o_block_device *dev = disk->private_data; 654 struct i2o_block_device *dev = disk->private_data;
656 int ret = -ENOTTY;
657 655
658 /* Anyone capable of this syscall can do *real bad* things */ 656 /* Anyone capable of this syscall can do *real bad* things */
659 657
660 if (!capable(CAP_SYS_ADMIN)) 658 if (!capable(CAP_SYS_ADMIN))
661 return -EPERM; 659 return -EPERM;
662 660
663 lock_kernel();
664 switch (cmd) { 661 switch (cmd) {
665 case BLKI2OGRSTRAT: 662 case BLKI2OGRSTRAT:
666 ret = put_user(dev->rcache, (int __user *)arg); 663 return put_user(dev->rcache, (int __user *)arg);
667 break;
668 case BLKI2OGWSTRAT: 664 case BLKI2OGWSTRAT:
669 ret = put_user(dev->wcache, (int __user *)arg); 665 return put_user(dev->wcache, (int __user *)arg);
670 break;
671 case BLKI2OSRSTRAT: 666 case BLKI2OSRSTRAT:
672 ret = -EINVAL;
673 if (arg < 0 || arg > CACHE_SMARTFETCH) 667 if (arg < 0 || arg > CACHE_SMARTFETCH)
674 break; 668 return -EINVAL;
675 dev->rcache = arg; 669 dev->rcache = arg;
676 ret = 0;
677 break; 670 break;
678 case BLKI2OSWSTRAT: 671 case BLKI2OSWSTRAT:
679 ret = -EINVAL;
680 if (arg != 0 672 if (arg != 0
681 && (arg < CACHE_WRITETHROUGH || arg > CACHE_SMARTBACK)) 673 && (arg < CACHE_WRITETHROUGH || arg > CACHE_SMARTBACK))
682 break; 674 return -EINVAL;
683 dev->wcache = arg; 675 dev->wcache = arg;
684 ret = 0;
685 break; 676 break;
686 } 677 }
687 unlock_kernel(); 678 return -ENOTTY;
688
689 return ret;
690}; 679};
691 680
692/** 681/**
@@ -942,7 +931,6 @@ static const struct block_device_operations i2o_block_fops = {
942 .open = i2o_block_open, 931 .open = i2o_block_open,
943 .release = i2o_block_release, 932 .release = i2o_block_release,
944 .ioctl = i2o_block_ioctl, 933 .ioctl = i2o_block_ioctl,
945 .compat_ioctl = i2o_block_ioctl,
946 .getgeo = i2o_block_getgeo, 934 .getgeo = i2o_block_getgeo,
947 .media_changed = i2o_block_media_changed 935 .media_changed = i2o_block_media_changed
948}; 936};