Commit ea0d3ab239fba48d6e998b19c28d78f765963007
Committed by
James Morris
1 parent
3e62cbb843
Exists in
master
and in
20 other branches
LSM: Remove unused arguments from security_path_truncate().
When commit be6d3e56a6b9b3a4ee44a0685e39e595073c6f0d "introduce new LSM hooks where vfsmount is available." was proposed, regarding security_path_truncate(), only "struct file *" argument (which AppArmor wanted to use) was removed. But length and time_attrs arguments are not used by TOMOYO nor AppArmor. Thus, let's remove these arguments. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Acked-by: Nick Piggin <npiggin@suse.de> Signed-off-by: James Morris <jmorris@namei.org>
Showing 6 changed files with 10 additions and 20 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -1484,8 +1484,7 @@ |
1484 | 1484 | */ |
1485 | 1485 | error = locks_verify_locked(inode); |
1486 | 1486 | if (!error) |
1487 | - error = security_path_truncate(path, 0, | |
1488 | - ATTR_MTIME|ATTR_CTIME|ATTR_OPEN); | |
1487 | + error = security_path_truncate(path); | |
1489 | 1488 | if (!error) { |
1490 | 1489 | error = do_truncate(path->dentry, 0, |
1491 | 1490 | ATTR_MTIME|ATTR_CTIME|ATTR_OPEN, |
fs/open.c
... | ... | @@ -110,7 +110,7 @@ |
110 | 110 | |
111 | 111 | error = locks_verify_truncate(inode, NULL, length); |
112 | 112 | if (!error) |
113 | - error = security_path_truncate(&path, length, 0); | |
113 | + error = security_path_truncate(&path); | |
114 | 114 | if (!error) |
115 | 115 | error = do_truncate(path.dentry, length, 0, NULL); |
116 | 116 | |
... | ... | @@ -165,8 +165,7 @@ |
165 | 165 | |
166 | 166 | error = locks_verify_truncate(inode, file, length); |
167 | 167 | if (!error) |
168 | - error = security_path_truncate(&file->f_path, length, | |
169 | - ATTR_MTIME|ATTR_CTIME); | |
168 | + error = security_path_truncate(&file->f_path); | |
170 | 169 | if (!error) |
171 | 170 | error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); |
172 | 171 | out_putf: |
include/linux/security.h
... | ... | @@ -470,8 +470,6 @@ |
470 | 470 | * @path_truncate: |
471 | 471 | * Check permission before truncating a file. |
472 | 472 | * @path contains the path structure for the file. |
473 | - * @length is the new length of the file. | |
474 | - * @time_attrs is the flags passed to do_truncate(). | |
475 | 473 | * Return 0 if permission is granted. |
476 | 474 | * @inode_getattr: |
477 | 475 | * Check permission before obtaining file attributes. |
... | ... | @@ -1412,8 +1410,7 @@ |
1412 | 1410 | int (*path_rmdir) (struct path *dir, struct dentry *dentry); |
1413 | 1411 | int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, |
1414 | 1412 | unsigned int dev); |
1415 | - int (*path_truncate) (struct path *path, loff_t length, | |
1416 | - unsigned int time_attrs); | |
1413 | + int (*path_truncate) (struct path *path); | |
1417 | 1414 | int (*path_symlink) (struct path *dir, struct dentry *dentry, |
1418 | 1415 | const char *old_name); |
1419 | 1416 | int (*path_link) (struct dentry *old_dentry, struct path *new_dir, |
... | ... | @@ -2806,8 +2803,7 @@ |
2806 | 2803 | int security_path_rmdir(struct path *dir, struct dentry *dentry); |
2807 | 2804 | int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, |
2808 | 2805 | unsigned int dev); |
2809 | -int security_path_truncate(struct path *path, loff_t length, | |
2810 | - unsigned int time_attrs); | |
2806 | +int security_path_truncate(struct path *path); | |
2811 | 2807 | int security_path_symlink(struct path *dir, struct dentry *dentry, |
2812 | 2808 | const char *old_name); |
2813 | 2809 | int security_path_link(struct dentry *old_dentry, struct path *new_dir, |
... | ... | @@ -2841,8 +2837,7 @@ |
2841 | 2837 | return 0; |
2842 | 2838 | } |
2843 | 2839 | |
2844 | -static inline int security_path_truncate(struct path *path, loff_t length, | |
2845 | - unsigned int time_attrs) | |
2840 | +static inline int security_path_truncate(struct path *path) | |
2846 | 2841 | { |
2847 | 2842 | return 0; |
2848 | 2843 | } |
security/capability.c
security/security.c
... | ... | @@ -417,12 +417,11 @@ |
417 | 417 | new_dentry); |
418 | 418 | } |
419 | 419 | |
420 | -int security_path_truncate(struct path *path, loff_t length, | |
421 | - unsigned int time_attrs) | |
420 | +int security_path_truncate(struct path *path) | |
422 | 421 | { |
423 | 422 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) |
424 | 423 | return 0; |
425 | - return security_ops->path_truncate(path, length, time_attrs); | |
424 | + return security_ops->path_truncate(path); | |
426 | 425 | } |
427 | 426 | |
428 | 427 | int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, |
security/tomoyo/tomoyo.c
... | ... | @@ -93,8 +93,7 @@ |
93 | 93 | return tomoyo_check_open_permission(domain, &bprm->file->f_path, O_RDONLY); |
94 | 94 | } |
95 | 95 | |
96 | -static int tomoyo_path_truncate(struct path *path, loff_t length, | |
97 | - unsigned int time_attrs) | |
96 | +static int tomoyo_path_truncate(struct path *path) | |
98 | 97 | { |
99 | 98 | return tomoyo_path_perm(TOMOYO_TYPE_TRUNCATE, path); |
100 | 99 | } |