Skip to content

Commit 77c70de

Browse files
dhowellsxjamesmorris
authored andcommitted
CRED: Wrap task credential accesses in the hugetlbfs filesystem
Wrap access to task credentials so that they can be separated more easily from the task_struct during the introduction of COW creds. Change most current->(|e|s|fs)[ug]id to current_(|e|s|fs)[ug]id(). Change some task->e?[ug]id to task_e?[ug]id(). In some places it makes more sense to use RCU directly rather than a convenient wrapper; these will be addressed by later patches. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: James Morris <jmorris@namei.org> Acked-by: Serge Hallyn <serue@us.ibm.com> Cc: William Irwin <wli@holomorphy.com> Signed-off-by: James Morris <jmorris@namei.org>
1 parent de395b8 commit 77c70de

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎fs/hugetlbfs/inode.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,9 @@ static int hugetlbfs_mknod(struct inode *dir,
551551
if (S_ISDIR(mode))
552552
mode |= S_ISGID;
553553
} else {
554-
gid = current->fsgid;
554+
gid = current_fsgid();
555555
}
556-
inode = hugetlbfs_get_inode(dir->i_sb, current->fsuid, gid, mode, dev);
556+
inode = hugetlbfs_get_inode(dir->i_sb, current_fsuid(), gid, mode, dev);
557557
if (inode) {
558558
dir->i_ctime = dir->i_mtime = CURRENT_TIME;
559559
d_instantiate(dentry, inode);
@@ -586,9 +586,9 @@ static int hugetlbfs_symlink(struct inode *dir,
586586
if (dir->i_mode & S_ISGID)
587587
gid = dir->i_gid;
588588
else
589-
gid = current->fsgid;
589+
gid = current_fsgid();
590590

591-
inode = hugetlbfs_get_inode(dir->i_sb, current->fsuid,
591+
inode = hugetlbfs_get_inode(dir->i_sb, current_fsuid(),
592592
gid, S_IFLNK|S_IRWXUGO, 0);
593593
if (inode) {
594594
int l = strlen(symname)+1;
@@ -854,8 +854,8 @@ hugetlbfs_fill_super(struct super_block *sb, void *data, int silent)
854854

855855
config.nr_blocks = -1; /* No limit on size by default */
856856
config.nr_inodes = -1; /* No limit on number of inodes by default */
857-
config.uid = current->fsuid;
858-
config.gid = current->fsgid;
857+
config.uid = current_fsuid();
858+
config.gid = current_fsgid();
859859
config.mode = 0755;
860860
config.hstate = &default_hstate;
861861
ret = hugetlbfs_parse_options(data, &config);
@@ -970,8 +970,8 @@ struct file *hugetlb_file_setup(const char *name, size_t size)
970970
goto out_shm_unlock;
971971

972972
error = -ENOSPC;
973-
inode = hugetlbfs_get_inode(root->d_sb, current->fsuid,
974-
current->fsgid, S_IFREG | S_IRWXUGO, 0);
973+
inode = hugetlbfs_get_inode(root->d_sb, current_fsuid(),
974+
current_fsgid(), S_IFREG | S_IRWXUGO, 0);
975975
if (!inode)
976976
goto out_dentry;
977977

0 commit comments

Comments
 (0)