diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fuse/dir.c | 2 | ||||
-rw-r--r-- | fs/namei.c | 6 | ||||
-rw-r--r-- | fs/nfs/dir.c | 2 | ||||
-rw-r--r-- | fs/open.c | 11 |
4 files changed, 9 insertions, 12 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 3cdc5f78a406..431be0795b6b 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1016,7 +1016,7 @@ static int fuse_permission(struct inode *inode, int mask) | |||
1016 | exist. So if permissions are revoked this won't be | 1016 | exist. So if permissions are revoked this won't be |
1017 | noticed immediately, only after the attribute | 1017 | noticed immediately, only after the attribute |
1018 | timeout has expired */ | 1018 | timeout has expired */ |
1019 | } else if (mask & MAY_ACCESS) { | 1019 | } else if (mask & (MAY_ACCESS | MAY_CHDIR)) { |
1020 | err = fuse_access(inode, mask); | 1020 | err = fuse_access(inode, mask); |
1021 | } else if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode)) { | 1021 | } else if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode)) { |
1022 | if (!(inode->i_mode & S_IXUGO)) { | 1022 | if (!(inode->i_mode & S_IXUGO)) { |
diff --git a/fs/namei.c b/fs/namei.c index 868d0cb9d473..42d2d28fb827 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -282,8 +282,7 @@ int inode_permission(struct inode *inode, int mask) | |||
282 | if (retval) | 282 | if (retval) |
283 | return retval; | 283 | return retval; |
284 | 284 | ||
285 | return security_inode_permission(inode, | 285 | return security_inode_permission(inode, mask); |
286 | mask & (MAY_READ|MAY_WRITE|MAY_EXEC|MAY_APPEND)); | ||
287 | } | 286 | } |
288 | 287 | ||
289 | /** | 288 | /** |
@@ -1484,8 +1483,7 @@ static int handle_truncate(struct path *path) | |||
1484 | */ | 1483 | */ |
1485 | error = locks_verify_locked(inode); | 1484 | error = locks_verify_locked(inode); |
1486 | if (!error) | 1485 | if (!error) |
1487 | error = security_path_truncate(path, 0, | 1486 | error = security_path_truncate(path); |
1488 | ATTR_MTIME|ATTR_CTIME|ATTR_OPEN); | ||
1489 | if (!error) { | 1487 | if (!error) { |
1490 | error = do_truncate(path->dentry, 0, | 1488 | error = do_truncate(path->dentry, 0, |
1491 | ATTR_MTIME|ATTR_CTIME|ATTR_OPEN, | 1489 | ATTR_MTIME|ATTR_CTIME|ATTR_OPEN, |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index e60416d3f818..832e9e239324 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1953,7 +1953,7 @@ int nfs_permission(struct inode *inode, int mask) | |||
1953 | if ((mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0) | 1953 | if ((mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0) |
1954 | goto out; | 1954 | goto out; |
1955 | /* Is this sys_access() ? */ | 1955 | /* Is this sys_access() ? */ |
1956 | if (mask & MAY_ACCESS) | 1956 | if (mask & (MAY_ACCESS | MAY_CHDIR)) |
1957 | goto force_lookup; | 1957 | goto force_lookup; |
1958 | 1958 | ||
1959 | switch (inode->i_mode & S_IFMT) { | 1959 | switch (inode->i_mode & S_IFMT) { |
@@ -110,7 +110,7 @@ static long do_sys_truncate(const char __user *pathname, loff_t length) | |||
110 | 110 | ||
111 | error = locks_verify_truncate(inode, NULL, length); | 111 | error = locks_verify_truncate(inode, NULL, length); |
112 | if (!error) | 112 | if (!error) |
113 | error = security_path_truncate(&path, length, 0); | 113 | error = security_path_truncate(&path); |
114 | if (!error) | 114 | if (!error) |
115 | error = do_truncate(path.dentry, length, 0, NULL); | 115 | error = do_truncate(path.dentry, length, 0, NULL); |
116 | 116 | ||
@@ -165,8 +165,7 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) | |||
165 | 165 | ||
166 | error = locks_verify_truncate(inode, file, length); | 166 | error = locks_verify_truncate(inode, file, length); |
167 | if (!error) | 167 | if (!error) |
168 | error = security_path_truncate(&file->f_path, length, | 168 | error = security_path_truncate(&file->f_path); |
169 | ATTR_MTIME|ATTR_CTIME); | ||
170 | if (!error) | 169 | if (!error) |
171 | error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); | 170 | error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); |
172 | out_putf: | 171 | out_putf: |
@@ -367,7 +366,7 @@ SYSCALL_DEFINE1(chdir, const char __user *, filename) | |||
367 | if (error) | 366 | if (error) |
368 | goto out; | 367 | goto out; |
369 | 368 | ||
370 | error = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS); | 369 | error = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_CHDIR); |
371 | if (error) | 370 | if (error) |
372 | goto dput_and_out; | 371 | goto dput_and_out; |
373 | 372 | ||
@@ -396,7 +395,7 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd) | |||
396 | if (!S_ISDIR(inode->i_mode)) | 395 | if (!S_ISDIR(inode->i_mode)) |
397 | goto out_putf; | 396 | goto out_putf; |
398 | 397 | ||
399 | error = inode_permission(inode, MAY_EXEC | MAY_ACCESS); | 398 | error = inode_permission(inode, MAY_EXEC | MAY_CHDIR); |
400 | if (!error) | 399 | if (!error) |
401 | set_fs_pwd(current->fs, &file->f_path); | 400 | set_fs_pwd(current->fs, &file->f_path); |
402 | out_putf: | 401 | out_putf: |
@@ -414,7 +413,7 @@ SYSCALL_DEFINE1(chroot, const char __user *, filename) | |||
414 | if (error) | 413 | if (error) |
415 | goto out; | 414 | goto out; |
416 | 415 | ||
417 | error = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS); | 416 | error = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_CHDIR); |
418 | if (error) | 417 | if (error) |
419 | goto dput_and_out; | 418 | goto dput_and_out; |
420 | 419 | ||