Commit cdcf116d44e78c7216ba9f8be9af1cdfca7af728

Authored by Al Viro
1 parent d8c9584ea2

switch security_path_chmod() to struct path *

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 6 changed files with 15 additions and 25 deletions Side-by-side Diff

... ... @@ -456,7 +456,7 @@
456 456 if (error)
457 457 return error;
458 458 mutex_lock(&inode->i_mutex);
459   - error = security_path_chmod(path->dentry, path->mnt, mode);
  459 + error = security_path_chmod(path, mode);
460 460 if (error)
461 461 goto out_unlock;
462 462 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
include/linux/security.h
... ... @@ -1435,8 +1435,7 @@
1435 1435 struct dentry *new_dentry);
1436 1436 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
1437 1437 struct path *new_dir, struct dentry *new_dentry);
1438   - int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt,
1439   - umode_t mode);
  1438 + int (*path_chmod) (struct path *path, umode_t mode);
1440 1439 int (*path_chown) (struct path *path, uid_t uid, gid_t gid);
1441 1440 int (*path_chroot) (struct path *path);
1442 1441 #endif
... ... @@ -2866,8 +2865,7 @@
2866 2865 struct dentry *new_dentry);
2867 2866 int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
2868 2867 struct path *new_dir, struct dentry *new_dentry);
2869   -int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
2870   - umode_t mode);
  2868 +int security_path_chmod(struct path *path, umode_t mode);
2871 2869 int security_path_chown(struct path *path, uid_t uid, gid_t gid);
2872 2870 int security_path_chroot(struct path *path);
2873 2871 #else /* CONFIG_SECURITY_PATH */
... ... @@ -2919,9 +2917,7 @@
2919 2917 return 0;
2920 2918 }
2921 2919  
2922   -static inline int security_path_chmod(struct dentry *dentry,
2923   - struct vfsmount *mnt,
2924   - umode_t mode)
  2920 +static inline int security_path_chmod(struct path *path, umode_t mode)
2925 2921 {
2926 2922 return 0;
2927 2923 }
security/apparmor/lsm.c
... ... @@ -344,13 +344,12 @@
344 344 return error;
345 345 }
346 346  
347   -static int apparmor_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
348   - umode_t mode)
  347 +static int apparmor_path_chmod(struct path *path, umode_t mode)
349 348 {
350   - if (!mediated_filesystem(dentry->d_inode))
  349 + if (!mediated_filesystem(path->dentry->d_inode))
351 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  
356 355 static int apparmor_path_chown(struct path *path, uid_t uid, gid_t gid)
security/capability.c
... ... @@ -279,8 +279,7 @@
279 279 return 0;
280 280 }
281 281  
282   -static int cap_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
283   - umode_t mode)
  282 +static int cap_path_chmod(struct path *path, umode_t mode)
284 283 {
285 284 return 0;
286 285 }
... ... @@ -454,12 +454,11 @@
454 454 return security_ops->path_truncate(path);
455 455 }
456 456  
457   -int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
458   - umode_t mode)
  457 +int security_path_chmod(struct path *path, umode_t mode)
459 458 {
460   - if (unlikely(IS_PRIVATE(dentry->d_inode)))
  459 + if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
461 460 return 0;
462   - return security_ops->path_chmod(dentry, mnt, mode);
  461 + return security_ops->path_chmod(path, mode);
463 462 }
464 463  
465 464 int security_path_chown(struct path *path, uid_t uid, gid_t gid)
security/tomoyo/tomoyo.c
... ... @@ -353,17 +353,14 @@
353 353 /**
354 354 * tomoyo_path_chmod - Target for security_path_chmod().
355 355 *
356   - * @dentry: Pointer to "struct dentry".
357   - * @mnt: Pointer to "struct vfsmount".
358   - * @mode: DAC permission mode.
  356 + * @path: Pointer to "struct path".
  357 + * @mode: DAC permission mode.
359 358 *
360 359 * Returns 0 on success, negative value otherwise.
361 360 */
362   -static int tomoyo_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
363   - umode_t mode)
  361 +static int tomoyo_path_chmod(struct path *path, umode_t mode)
364 362 {
365   - struct path path = { mnt, dentry };
366   - return tomoyo_path_number_perm(TOMOYO_TYPE_CHMOD, &path,
  363 + return tomoyo_path_number_perm(TOMOYO_TYPE_CHMOD, path,
367 364 mode & S_IALLUGO);
368 365 }
369 366