aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-12-08 10:51:53 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-06 23:16:53 -0500
commitcdcf116d44e78c7216ba9f8be9af1cdfca7af728 (patch)
tree2417cfd3e06ac5e2468585e8f00d580242cb5571
parentd8c9584ea2a92879f471fd3a2be3af6c534fb035 (diff)
switch security_path_chmod() to struct path *
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/open.c2
-rw-r--r--include/linux/security.h10
-rw-r--r--security/apparmor/lsm.c7
-rw-r--r--security/capability.c3
-rw-r--r--security/security.c7
-rw-r--r--security/tomoyo/tomoyo.c11
6 files changed, 15 insertions, 25 deletions
diff --git a/fs/open.c b/fs/open.c
index 2659f596f4c5..77becc041149 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -456,7 +456,7 @@ static int chmod_common(struct path *path, umode_t mode)
456 if (error) 456 if (error)
457 return error; 457 return error;
458 mutex_lock(&inode->i_mutex); 458 mutex_lock(&inode->i_mutex);
459 error = security_path_chmod(path->dentry, path->mnt, mode); 459 error = security_path_chmod(path, mode);
460 if (error) 460 if (error)
461 goto out_unlock; 461 goto out_unlock;
462 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); 462 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
diff --git a/include/linux/security.h b/include/linux/security.h
index 535721cc374a..4298d2dbafa3 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1435,8 +1435,7 @@ struct security_operations {
1435 struct dentry *new_dentry); 1435 struct dentry *new_dentry);
1436 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, 1436 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
1437 struct path *new_dir, struct dentry *new_dentry); 1437 struct path *new_dir, struct dentry *new_dentry);
1438 int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt, 1438 int (*path_chmod) (struct path *path, umode_t mode);
1439 umode_t mode);
1440 int (*path_chown) (struct path *path, uid_t uid, gid_t gid); 1439 int (*path_chown) (struct path *path, uid_t uid, gid_t gid);
1441 int (*path_chroot) (struct path *path); 1440 int (*path_chroot) (struct path *path);
1442#endif 1441#endif
@@ -2866,8 +2865,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
2866 struct dentry *new_dentry); 2865 struct dentry *new_dentry);
2867int security_path_rename(struct path *old_dir, struct dentry *old_dentry, 2866int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
2868 struct path *new_dir, struct dentry *new_dentry); 2867 struct path *new_dir, struct dentry *new_dentry);
2869int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 2868int security_path_chmod(struct path *path, umode_t mode);
2870 umode_t mode);
2871int security_path_chown(struct path *path, uid_t uid, gid_t gid); 2869int security_path_chown(struct path *path, uid_t uid, gid_t gid);
2872int security_path_chroot(struct path *path); 2870int security_path_chroot(struct path *path);
2873#else /* CONFIG_SECURITY_PATH */ 2871#else /* CONFIG_SECURITY_PATH */
@@ -2919,9 +2917,7 @@ static inline int security_path_rename(struct path *old_dir,
2919 return 0; 2917 return 0;
2920} 2918}
2921 2919
2922static inline int security_path_chmod(struct dentry *dentry, 2920static inline int security_path_chmod(struct path *path, umode_t mode)
2923 struct vfsmount *mnt,
2924 umode_t mode)
2925{ 2921{
2926 return 0; 2922 return 0;
2927} 2923}
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index c0a399ec1df9..2c0a0ff41399 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -344,13 +344,12 @@ static int apparmor_path_rename(struct path *old_dir, struct dentry *old_dentry,
344 return error; 344 return error;
345} 345}
346 346
347static int apparmor_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 347static int apparmor_path_chmod(struct path *path, umode_t mode)
348 umode_t mode)
349{ 348{
350 if (!mediated_filesystem(dentry->d_inode)) 349 if (!mediated_filesystem(path->dentry->d_inode))
351 return 0; 350 return 0;
352 351
353 return common_perm_mnt_dentry(OP_CHMOD, mnt, dentry, AA_MAY_CHMOD); 352 return common_perm_mnt_dentry(OP_CHMOD, path->mnt, path->dentry, AA_MAY_CHMOD);
354} 353}
355 354
356static int apparmor_path_chown(struct path *path, uid_t uid, gid_t gid) 355static int apparmor_path_chown(struct path *path, uid_t uid, gid_t gid)
diff --git a/security/capability.c b/security/capability.c
index 156816d451ba..3b5883b7179f 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -279,8 +279,7 @@ static int cap_path_truncate(struct path *path)
279 return 0; 279 return 0;
280} 280}
281 281
282static int cap_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 282static int cap_path_chmod(struct path *path, umode_t mode)
283 umode_t mode)
284{ 283{
285 return 0; 284 return 0;
286} 285}
diff --git a/security/security.c b/security/security.c
index 151152de1a0a..214502c772ab 100644
--- a/security/security.c
+++ b/security/security.c
@@ -454,12 +454,11 @@ int security_path_truncate(struct path *path)
454 return security_ops->path_truncate(path); 454 return security_ops->path_truncate(path);
455} 455}
456 456
457int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 457int security_path_chmod(struct path *path, umode_t mode)
458 umode_t mode)
459{ 458{
460 if (unlikely(IS_PRIVATE(dentry->d_inode))) 459 if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
461 return 0; 460 return 0;
462 return security_ops->path_chmod(dentry, mnt, mode); 461 return security_ops->path_chmod(path, mode);
463} 462}
464 463
465int security_path_chown(struct path *path, uid_t uid, gid_t gid) 464int security_path_chown(struct path *path, uid_t uid, gid_t gid)
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c
index 75c956a51e75..620d37c159a3 100644
--- a/security/tomoyo/tomoyo.c
+++ b/security/tomoyo/tomoyo.c
@@ -353,17 +353,14 @@ static int tomoyo_file_ioctl(struct file *file, unsigned int cmd,
353/** 353/**
354 * tomoyo_path_chmod - Target for security_path_chmod(). 354 * tomoyo_path_chmod - Target for security_path_chmod().
355 * 355 *
356 * @dentry: Pointer to "struct dentry". 356 * @path: Pointer to "struct path".
357 * @mnt: Pointer to "struct vfsmount". 357 * @mode: DAC permission mode.
358 * @mode: DAC permission mode.
359 * 358 *
360 * Returns 0 on success, negative value otherwise. 359 * Returns 0 on success, negative value otherwise.
361 */ 360 */
362static int tomoyo_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 361static int tomoyo_path_chmod(struct path *path, umode_t mode)
363 umode_t mode)
364{ 362{
365 struct path path = { mnt, dentry }; 363 return tomoyo_path_number_perm(TOMOYO_TYPE_CHMOD, path,
366 return tomoyo_path_number_perm(TOMOYO_TYPE_CHMOD, &path,
367 mode & S_IALLUGO); 364 mode & S_IALLUGO);
368} 365}
369 366