diff options
author | Chris Mason | 2009-01-05 22:57:23 +0100 |
---|---|---|
committer | Chris Mason | 2009-01-05 22:57:23 +0100 |
commit | e441d54de4fd97dd381f3e73636f5ba51ff4c7d9 (patch) | |
tree | b0d664ffaa89cec80e6aaac11977c7f6aa92ff63 /fs/btrfs/super.c | |
parent | Btrfs: Fix compile warning around num_online_cpus() in a min statement (diff) | |
download | kernel-qcow2-linux-e441d54de4fd97dd381f3e73636f5ba51ff4c7d9.tar.gz kernel-qcow2-linux-e441d54de4fd97dd381f3e73636f5ba51ff4c7d9.tar.xz kernel-qcow2-linux-e441d54de4fd97dd381f3e73636f5ba51ff4c7d9.zip |
Btrfs: add permission checks to the ioctls
Only root can add/remove devices
Only root can defrag subtrees
Only files open for writing can be defragged
Only files open for writing can be the destination for a clone
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 84c3b66564d0..3814238d6eba 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -589,6 +589,9 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd, int ret = 0; int len; + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + vol = kmalloc(sizeof(*vol), GFP_KERNEL); if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) { ret = -EFAULT; |