Skip to content

Commit de395b8

Browse files
dhowellsxjamesmorris
authored andcommitted
CRED: Wrap task credential accesses in the HPFS 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: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> Signed-off-by: James Morris <jmorris@namei.org>
1 parent 4ac8489 commit de395b8

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎fs/hpfs/namei.c‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
9292
inc_nlink(dir);
9393
insert_inode_hash(result);
9494

95-
if (result->i_uid != current->fsuid ||
96-
result->i_gid != current->fsgid ||
95+
if (result->i_uid != current_fsuid() ||
96+
result->i_gid != current_fsgid() ||
9797
result->i_mode != (mode | S_IFDIR)) {
98-
result->i_uid = current->fsuid;
99-
result->i_gid = current->fsgid;
98+
result->i_uid = current_fsuid();
99+
result->i_gid = current_fsgid();
100100
result->i_mode = mode | S_IFDIR;
101101
hpfs_write_inode_nolock(result);
102102
}
@@ -184,11 +184,11 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
184184

185185
insert_inode_hash(result);
186186

187-
if (result->i_uid != current->fsuid ||
188-
result->i_gid != current->fsgid ||
187+
if (result->i_uid != current_fsuid() ||
188+
result->i_gid != current_fsgid() ||
189189
result->i_mode != (mode | S_IFREG)) {
190-
result->i_uid = current->fsuid;
191-
result->i_gid = current->fsgid;
190+
result->i_uid = current_fsuid();
191+
result->i_gid = current_fsgid();
192192
result->i_mode = mode | S_IFREG;
193193
hpfs_write_inode_nolock(result);
194194
}
@@ -247,8 +247,8 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t
247247
result->i_mtime.tv_nsec = 0;
248248
result->i_atime.tv_nsec = 0;
249249
hpfs_i(result)->i_ea_size = 0;
250-
result->i_uid = current->fsuid;
251-
result->i_gid = current->fsgid;
250+
result->i_uid = current_fsuid();
251+
result->i_gid = current_fsgid();
252252
result->i_nlink = 1;
253253
result->i_size = 0;
254254
result->i_blocks = 1;
@@ -325,8 +325,8 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
325325
result->i_atime.tv_nsec = 0;
326326
hpfs_i(result)->i_ea_size = 0;
327327
result->i_mode = S_IFLNK | 0777;
328-
result->i_uid = current->fsuid;
329-
result->i_gid = current->fsgid;
328+
result->i_uid = current_fsuid();
329+
result->i_gid = current_fsgid();
330330
result->i_blocks = 1;
331331
result->i_nlink = 1;
332332
result->i_size = strlen(symlink);

‎fs/hpfs/super.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,8 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
475475

476476
init_MUTEX(&sbi->hpfs_creation_de);
477477

478-
uid = current->uid;
479-
gid = current->gid;
478+
uid = current_uid();
479+
gid = current_gid();
480480
umask = current->fs->umask;
481481
lowercase = 0;
482482
conv = CONV_BINARY;

0 commit comments

Comments
 (0)