diff options
Diffstat (limited to 'fs/hugetlbfs')
-rw-r--r-- | fs/hugetlbfs/inode.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index eba6d552d9c9..133335479c24 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -936,15 +936,9 @@ static struct file_system_type hugetlbfs_fs_type = { | |||
936 | 936 | ||
937 | static struct vfsmount *hugetlbfs_vfsmount; | 937 | static struct vfsmount *hugetlbfs_vfsmount; |
938 | 938 | ||
939 | static int can_do_hugetlb_shm(int creat_flags) | 939 | static int can_do_hugetlb_shm(void) |
940 | { | 940 | { |
941 | if (creat_flags != HUGETLB_SHMFS_INODE) | 941 | return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group); |
942 | return 0; | ||
943 | if (capable(CAP_IPC_LOCK)) | ||
944 | return 1; | ||
945 | if (in_group_p(sysctl_hugetlb_shm_group)) | ||
946 | return 1; | ||
947 | return 0; | ||
948 | } | 942 | } |
949 | 943 | ||
950 | struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag, | 944 | struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag, |
@@ -960,7 +954,7 @@ struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag, | |||
960 | if (!hugetlbfs_vfsmount) | 954 | if (!hugetlbfs_vfsmount) |
961 | return ERR_PTR(-ENOENT); | 955 | return ERR_PTR(-ENOENT); |
962 | 956 | ||
963 | if (!can_do_hugetlb_shm(creat_flags)) { | 957 | if (creat_flags == HUGETLB_SHMFS_INODE && !can_do_hugetlb_shm()) { |
964 | *user = current_user(); | 958 | *user = current_user(); |
965 | if (user_shm_lock(size, *user)) { | 959 | if (user_shm_lock(size, *user)) { |
966 | WARN_ONCE(1, | 960 | WARN_ONCE(1, |