md: allow non-privileged uses to GET_*_INFO about raid arrays.
authorNeilBrown <neilb@suse.de>
Thu, 22 Dec 2011 23:17:26 +0000 (10:17 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 22 Dec 2011 23:17:26 +0000 (10:17 +1100)
The info is already available in /proc/mdstat and /sys/block in
an accessible form so there is no point in putting a road-block in
the ioctl for information gathering.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c

index f47f1f8..004d8e5 100644 (file)
@@ -6054,8 +6054,15 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
        struct mddev *mddev = NULL;
        int ro;
 
-       if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
+       switch (cmd) {
+       case RAID_VERSION:
+       case GET_ARRAY_INFO:
+       case GET_DISK_INFO:
+               break;
+       default:
+               if (!capable(CAP_SYS_ADMIN))
+                       return -EACCES;
+       }
 
        /*
         * Commands dealing with the RAID driver but not any