aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-02-08 10:07:50 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-05-03 06:29:32 -0400
commit92361636e0153bd0cb22e7dfe3fc6287f6537c66 (patch)
tree8b7d8f91aa528c2bad8ff97c737b2612e414480a /fs/inode.c
parent5af662030e5db1a5560fd917250d5d688a6be586 (diff)
userns: Store uid and gid types in vfs structures with kuid_t and kgid_t types
The conversion of all of the users is not done yet there are too many to change in one go and leave the code reviewable. For now I change just the header and a few trivial users and rely on CONFIG_UIDGID_STRICT_TYPE_CHECKS not being set to ensure that the code will still compile during the transition. Helper functions i_uid_read, i_uid_write, i_gid_read, i_gid_write are added so that in most cases filesystems can avoid the complexities of multiple user namespaces and can concentrate on moving their raw numeric values into and out of the vfs data structures. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/inode.c b/fs/inode.c
index f0c4ace408e4..deb72f6c2b4f 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -135,8 +135,8 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
135 inode->i_fop = &empty_fops; 135 inode->i_fop = &empty_fops;
136 inode->__i_nlink = 1; 136 inode->__i_nlink = 1;
137 inode->i_opflags = 0; 137 inode->i_opflags = 0;
138 inode->i_uid = 0; 138 i_uid_write(inode, 0);
139 inode->i_gid = 0; 139 i_gid_write(inode, 0);
140 atomic_set(&inode->i_writecount, 0); 140 atomic_set(&inode->i_writecount, 0);
141 inode->i_size = 0; 141 inode->i_size = 0;
142 inode->i_blocks = 0; 142 inode->i_blocks = 0;
@@ -1732,7 +1732,7 @@ EXPORT_SYMBOL(inode_init_owner);
1732 */ 1732 */
1733bool inode_owner_or_capable(const struct inode *inode) 1733bool inode_owner_or_capable(const struct inode *inode)
1734{ 1734{
1735 if (current_fsuid() == inode->i_uid) 1735 if (uid_eq(current_fsuid(), inode->i_uid))
1736 return true; 1736 return true;
1737 if (inode_capable(inode, CAP_FOWNER)) 1737 if (inode_capable(inode, CAP_FOWNER))
1738 return true; 1738 return true;