Skip to content

Commit

Permalink
[PATCH] md: require CAP_SYS_ADMIN for (re-)configuring md devices via…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Jul 10, 2006
1 parent 80ca3a4 commit 67463ac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 67463ac

Please sign in to comment.