Skip to content

Commit a8dd4d6

Browse files
dhowellsxjamesmorris
authored andcommitted
CRED: Wrap task credential accesses in the Ext2 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: linux-ext4@vger.kernel.org Signed-off-by: James Morris <jmorris@namei.org>
1 parent 4eea035 commit a8dd4d6

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎fs/ext2/balloc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ static int ext2_has_free_blocks(struct ext2_sb_info *sbi)
11931193
free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
11941194
root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count);
11951195
if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) &&
1196-
sbi->s_resuid != current->fsuid &&
1196+
sbi->s_resuid != current_fsuid() &&
11971197
(sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) {
11981198
return 0;
11991199
}

‎fs/ext2/ialloc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,15 +550,15 @@ struct inode *ext2_new_inode(struct inode *dir, int mode)
550550

551551
sb->s_dirt = 1;
552552
mark_buffer_dirty(bh2);
553-
inode->i_uid = current->fsuid;
553+
inode->i_uid = current_fsuid();
554554
if (test_opt (sb, GRPID))
555555
inode->i_gid = dir->i_gid;
556556
else if (dir->i_mode & S_ISGID) {
557557
inode->i_gid = dir->i_gid;
558558
if (S_ISDIR(mode))
559559
mode |= S_ISGID;
560560
} else
561-
inode->i_gid = current->fsgid;
561+
inode->i_gid = current_fsgid();
562562
inode->i_mode = mode;
563563

564564
inode->i_ino = ino;

0 commit comments

Comments
 (0)