summaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown2006-07-10 13:44:19 +0200
committerLinus Torvalds2006-07-10 22:24:17 +0200
commit67463acb646904d76a8e237cc31eaa87872f30cc (patch)
tree4ccf373165581ed898328ca03365abfdd7d23a04 /drivers/md/md.c
parent[PATCH] md: unify usage of symbolic names for perms (diff)
downloadkernel-qcow2-linux-67463acb646904d76a8e237cc31eaa87872f30cc.tar.gz
kernel-qcow2-linux-67463acb646904d76a8e237cc31eaa87872f30cc.tar.xz
kernel-qcow2-linux-67463acb646904d76a8e237cc31eaa87872f30cc.zip
[PATCH] md: require CAP_SYS_ADMIN for (re-)configuring md devices via sysfs
The ioctl requires CAP_SYS_ADMIN, so sysfs should too. Note that we don't require CAP_SYS_ADMIN for reading attributes even though the ioctl does. There is no reason to limit the read access, and much of the information is already available via /proc/mdstat Cc: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index c0da5eedc245..a5286beddcf5 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1926,6 +1926,8 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr,
if (!entry->store)
return -EIO;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EACCES;
return entry->store(rdev, page, length);
}
@@ -2859,6 +2861,8 @@ md_attr_store(struct kobject *kobj, struct attribute *attr,
if (!entry->store)
return -EIO;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EACCES;
rv = mddev_lock(mddev);
if (!rv) {
rv = entry->store(mddev, page, length);