aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2010-06-02 00:24:43 -0400
committerJames Morris <jmorris@namei.org>2010-08-02 01:33:40 -0400
commitea0d3ab239fba48d6e998b19c28d78f765963007 (patch)
treec1e20273bf121a4f404ca7ac2a012161b0e0201e
parent3e62cbb8436f6c0cb799c8b7f106de7f662a7b8d (diff)
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>
-rw-r--r--fs/namei.c3
-rw-r--r--fs/open.c5
-rw-r--r--include/linux/security.h11
-rw-r--r--security/capability.c3
-rw-r--r--security/security.c5
-rw-r--r--security/tomoyo/tomoyo.c3
6 files changed, 10 insertions, 20 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 868d0cb9d473..fe34c2b879f4 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1484,8 +1484,7 @@ static int handle_truncate(struct path *path)
1484 */ 1484 */
1485 error = locks_verify_locked(inode); 1485 error = locks_verify_locked(inode);
1486 if (!error) 1486 if (!error)
1487 error = security_path_truncate(path, 0, 1487 error = security_path_truncate(path);
1488 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN);
1489 if (!error) { 1488 if (!error) {
1490 error = do_truncate(path->dentry, 0, 1489 error = do_truncate(path->dentry, 0,
1491 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN, 1490 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN,
diff --git a/fs/open.c b/fs/open.c
index 5463266db9e6..a54ed85209c1 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -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);
172out_putf: 171out_putf:
diff --git a/include/linux/security.h b/include/linux/security.h
index 0c8819170463..723a93df756a 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -470,8 +470,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
470 * @path_truncate: 470 * @path_truncate:
471 * Check permission before truncating a file. 471 * Check permission before truncating a file.
472 * @path contains the path structure for the file. 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 * Return 0 if permission is granted. 473 * Return 0 if permission is granted.
476 * @inode_getattr: 474 * @inode_getattr:
477 * Check permission before obtaining file attributes. 475 * Check permission before obtaining file attributes.
@@ -1412,8 +1410,7 @@ struct security_operations {
1412 int (*path_rmdir) (struct path *dir, struct dentry *dentry); 1410 int (*path_rmdir) (struct path *dir, struct dentry *dentry);
1413 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, 1411 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode,
1414 unsigned int dev); 1412 unsigned int dev);
1415 int (*path_truncate) (struct path *path, loff_t length, 1413 int (*path_truncate) (struct path *path);
1416 unsigned int time_attrs);
1417 int (*path_symlink) (struct path *dir, struct dentry *dentry, 1414 int (*path_symlink) (struct path *dir, struct dentry *dentry,
1418 const char *old_name); 1415 const char *old_name);
1419 int (*path_link) (struct dentry *old_dentry, struct path *new_dir, 1416 int (*path_link) (struct dentry *old_dentry, struct path *new_dir,
@@ -2806,8 +2803,7 @@ int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode);
2806int security_path_rmdir(struct path *dir, struct dentry *dentry); 2803int security_path_rmdir(struct path *dir, struct dentry *dentry);
2807int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, 2804int security_path_mknod(struct path *dir, struct dentry *dentry, int mode,
2808 unsigned int dev); 2805 unsigned int dev);
2809int security_path_truncate(struct path *path, loff_t length, 2806int security_path_truncate(struct path *path);
2810 unsigned int time_attrs);
2811int security_path_symlink(struct path *dir, struct dentry *dentry, 2807int security_path_symlink(struct path *dir, struct dentry *dentry,
2812 const char *old_name); 2808 const char *old_name);
2813int security_path_link(struct dentry *old_dentry, struct path *new_dir, 2809int security_path_link(struct dentry *old_dentry, struct path *new_dir,
@@ -2841,8 +2837,7 @@ static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
2841 return 0; 2837 return 0;
2842} 2838}
2843 2839
2844static inline int security_path_truncate(struct path *path, loff_t length, 2840static inline int security_path_truncate(struct path *path)
2845 unsigned int time_attrs)
2846{ 2841{
2847 return 0; 2842 return 0;
2848} 2843}
diff --git a/security/capability.c b/security/capability.c
index 8168e3ecd5bf..4aeb699da1b3 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -268,8 +268,7 @@ static int cap_path_rename(struct path *old_path, struct dentry *old_dentry,
268 return 0; 268 return 0;
269} 269}
270 270
271static int cap_path_truncate(struct path *path, loff_t length, 271static int cap_path_truncate(struct path *path)
272 unsigned int time_attrs)
273{ 272{
274 return 0; 273 return 0;
275} 274}
diff --git a/security/security.c b/security/security.c
index 351942a4ca0e..e8c87b8601b4 100644
--- a/security/security.c
+++ b/security/security.c
@@ -417,12 +417,11 @@ int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
417 new_dentry); 417 new_dentry);
418} 418}
419 419
420int security_path_truncate(struct path *path, loff_t length, 420int security_path_truncate(struct path *path)
421 unsigned int time_attrs)
422{ 421{
423 if (unlikely(IS_PRIVATE(path->dentry->d_inode))) 422 if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
424 return 0; 423 return 0;
425 return security_ops->path_truncate(path, length, time_attrs); 424 return security_ops->path_truncate(path);
426} 425}
427 426
428int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 427int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c
index 57d442e7339b..7be732cadd47 100644
--- a/security/tomoyo/tomoyo.c
+++ b/security/tomoyo/tomoyo.c
@@ -93,8 +93,7 @@ static int tomoyo_bprm_check_security(struct linux_binprm *bprm)
93 return tomoyo_check_open_permission(domain, &bprm->file->f_path, O_RDONLY); 93 return tomoyo_check_open_permission(domain, &bprm->file->f_path, O_RDONLY);
94} 94}
95 95
96static int tomoyo_path_truncate(struct path *path, loff_t length, 96static int tomoyo_path_truncate(struct path *path)
97 unsigned int time_attrs)
98{ 97{
99 return tomoyo_path_perm(TOMOYO_TYPE_TRUNCATE, path); 98 return tomoyo_path_perm(TOMOYO_TYPE_TRUNCATE, path);
100} 99}