ocfs2: Add missing permission checks

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>
This commit is contained in:
Mark Fasheh 2007-12-18 18:58:18 -08:00
parent 7909f2bf83
commit 0957f00796
1 changed files with 6 additions and 0 deletions

View File

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