]> err.no Git - linux-2.6/commitdiff
ocfs2: Add missing permission checks
authorMark Fasheh <mark.fasheh@oracle.com>
Wed, 19 Dec 2007 02:58:18 +0000 (18:58 -0800)
committerMark Fasheh <mark.fasheh@oracle.com>
Fri, 25 Jan 2008 23:05:19 +0000 (15:05 -0800)
Check that an online resize is being driven by a user with permission to
change system resource limits.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/ocfs2/ioctl.c

index 7003d5820d797d7e43c4013c881a7d0a58f8285b..5177fba5162b55616c77d8a1a2db7b5c28842297 100644 (file)
@@ -144,12 +144,18 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp,
 
                return ocfs2_change_file_space(filp, cmd, &sr);
        case OCFS2_IOC_GROUP_EXTEND:
+               if (!capable(CAP_SYS_RESOURCE))
+                       return -EPERM;
+
                if (get_user(new_clusters, (int __user *)arg))
                        return -EFAULT;
 
                return ocfs2_group_extend(inode, new_clusters);
        case OCFS2_IOC_GROUP_ADD:
        case OCFS2_IOC_GROUP_ADD64:
+               if (!capable(CAP_SYS_RESOURCE))
+                       return -EPERM;
+
                if (copy_from_user(&input, (int __user *) arg, sizeof(input)))
                        return -EFAULT;