diff options
author | David Howells <dhowells@redhat.com> | 2008-11-13 18:38:58 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-11-13 18:38:58 -0500 |
commit | 5cc0a84076e172c18fb927781f44c6e47d6c5a06 (patch) | |
tree | 1a8afb2b8b06f62e645ff7bbf544cd60adcdfcb9 /fs | |
parent | 48937024c65db88abafd0fb14021db31f09cd4ec (diff) |
CRED: Wrap task credential accesses in the NFS daemon
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: J. Bruce Fields <bfields@fieldses.org>
Cc: Neil Brown <neilb@suse.de>
Cc: linux-nfs@vger.kernel.org
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/vfs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 848a03e83a42..890d9a68c852 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1169,7 +1169,7 @@ nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *resfhp, | |||
1169 | * send along the gid on create when it tries to implement | 1169 | * send along the gid on create when it tries to implement |
1170 | * setgid directories via NFS: | 1170 | * setgid directories via NFS: |
1171 | */ | 1171 | */ |
1172 | if (current->fsuid != 0) | 1172 | if (current_fsuid() != 0) |
1173 | iap->ia_valid &= ~(ATTR_UID|ATTR_GID); | 1173 | iap->ia_valid &= ~(ATTR_UID|ATTR_GID); |
1174 | if (iap->ia_valid) | 1174 | if (iap->ia_valid) |
1175 | return nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); | 1175 | return nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); |
@@ -2004,7 +2004,7 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, | |||
2004 | IS_APPEND(inode)? " append" : "", | 2004 | IS_APPEND(inode)? " append" : "", |
2005 | __mnt_is_readonly(exp->ex_path.mnt)? " ro" : ""); | 2005 | __mnt_is_readonly(exp->ex_path.mnt)? " ro" : ""); |
2006 | dprintk(" owner %d/%d user %d/%d\n", | 2006 | dprintk(" owner %d/%d user %d/%d\n", |
2007 | inode->i_uid, inode->i_gid, current->fsuid, current->fsgid); | 2007 | inode->i_uid, inode->i_gid, current_fsuid(), current_fsgid()); |
2008 | #endif | 2008 | #endif |
2009 | 2009 | ||
2010 | /* Normally we reject any write/sattr etc access on a read-only file | 2010 | /* Normally we reject any write/sattr etc access on a read-only file |
@@ -2047,7 +2047,7 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, | |||
2047 | * with NFSv3. | 2047 | * with NFSv3. |
2048 | */ | 2048 | */ |
2049 | if ((acc & NFSD_MAY_OWNER_OVERRIDE) && | 2049 | if ((acc & NFSD_MAY_OWNER_OVERRIDE) && |
2050 | inode->i_uid == current->fsuid) | 2050 | inode->i_uid == current_fsuid()) |
2051 | return 0; | 2051 | return 0; |
2052 | 2052 | ||
2053 | /* This assumes NFSD_MAY_{READ,WRITE,EXEC} == MAY_{READ,WRITE,EXEC} */ | 2053 | /* This assumes NFSD_MAY_{READ,WRITE,EXEC} == MAY_{READ,WRITE,EXEC} */ |