diff options
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/inode.c b/fs/inode.c index e3ef2573cbdf..da93f7d160d4 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; |
@@ -1734,11 +1734,9 @@ EXPORT_SYMBOL(inode_init_owner); | |||
1734 | */ | 1734 | */ |
1735 | bool inode_owner_or_capable(const struct inode *inode) | 1735 | bool inode_owner_or_capable(const struct inode *inode) |
1736 | { | 1736 | { |
1737 | struct user_namespace *ns = inode_userns(inode); | 1737 | if (uid_eq(current_fsuid(), inode->i_uid)) |
1738 | |||
1739 | if (current_user_ns() == ns && current_fsuid() == inode->i_uid) | ||
1740 | return true; | 1738 | return true; |
1741 | if (ns_capable(ns, CAP_FOWNER)) | 1739 | if (inode_capable(inode, CAP_FOWNER)) |
1742 | return true; | 1740 | return true; |
1743 | return false; | 1741 | return false; |
1744 | } | 1742 | } |