aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/namei.c b/fs/namei.c
index d34e0f9681c6..af3783fff1de 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -186,7 +186,7 @@ int generic_permission(struct inode *inode, int mask,
186 186
187 mask &= MAY_READ | MAY_WRITE | MAY_EXEC; 187 mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
188 188
189 if (current->fsuid == inode->i_uid) 189 if (current_fsuid() == inode->i_uid)
190 mode >>= 6; 190 mode >>= 6;
191 else { 191 else {
192 if (IS_POSIXACL(inode) && (mode & S_IRWXG) && check_acl) { 192 if (IS_POSIXACL(inode) && (mode & S_IRWXG) && check_acl) {
@@ -441,7 +441,7 @@ static int exec_permission_lite(struct inode *inode)
441 if (inode->i_op && inode->i_op->permission) 441 if (inode->i_op && inode->i_op->permission)
442 return -EAGAIN; 442 return -EAGAIN;
443 443
444 if (current->fsuid == inode->i_uid) 444 if (current_fsuid() == inode->i_uid)
445 mode >>= 6; 445 mode >>= 6;
446 else if (in_group_p(inode->i_gid)) 446 else if (in_group_p(inode->i_gid))
447 mode >>= 3; 447 mode >>= 3;
@@ -1334,11 +1334,13 @@ static int user_path_parent(int dfd, const char __user *path,
1334 */ 1334 */
1335static inline int check_sticky(struct inode *dir, struct inode *inode) 1335static inline int check_sticky(struct inode *dir, struct inode *inode)
1336{ 1336{
1337 uid_t fsuid = current_fsuid();
1338
1337 if (!(dir->i_mode & S_ISVTX)) 1339 if (!(dir->i_mode & S_ISVTX))
1338 return 0; 1340 return 0;
1339 if (inode->i_uid == current->fsuid) 1341 if (inode->i_uid == fsuid)
1340 return 0; 1342 return 0;
1341 if (dir->i_uid == current->fsuid) 1343 if (dir->i_uid == fsuid)
1342 return 0; 1344 return 0;
1343 return !capable(CAP_FOWNER); 1345 return !capable(CAP_FOWNER);
1344} 1346}