Skip to content

Commit cdcf116

Browse files
author
Al Viro
committed
switch security_path_chmod() to struct path *
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent d8c9584 commit cdcf116

6 files changed

Lines changed: 15 additions & 25 deletions

File tree

‎fs/open.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ static int chmod_common(struct path *path, umode_t mode)
456456
if (error)
457457
return error;
458458
mutex_lock(&inode->i_mutex);
459-
error = security_path_chmod(path->dentry, path->mnt, mode);
459+
error = security_path_chmod(path, mode);
460460
if (error)
461461
goto out_unlock;
462462
newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);

‎include/linux/security.h‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,8 +1435,7 @@ struct security_operations {
14351435
struct dentry *new_dentry);
14361436
int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
14371437
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);
14401439
int (*path_chown) (struct path *path, uid_t uid, gid_t gid);
14411440
int (*path_chroot) (struct path *path);
14421441
#endif
@@ -2866,8 +2865,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
28662865
struct dentry *new_dentry);
28672866
int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
28682867
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);
28712869
int security_path_chown(struct path *path, uid_t uid, gid_t gid);
28722870
int security_path_chroot(struct path *path);
28732871
#else /* CONFIG_SECURITY_PATH */
@@ -2919,9 +2917,7 @@ static inline int security_path_rename(struct path *old_dir,
29192917
return 0;
29202918
}
29212919

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)
29252921
{
29262922
return 0;
29272923
}

‎security/apparmor/lsm.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,12 @@ static int apparmor_path_rename(struct path *old_dir, struct dentry *old_dentry,
344344
return error;
345345
}
346346

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)
349348
{
350-
if (!mediated_filesystem(dentry->d_inode))
349+
if (!mediated_filesystem(path->dentry->d_inode))
351350
return 0;
352351

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);
354353
}
355354

356355
static int apparmor_path_chown(struct path *path, uid_t uid, gid_t gid)

‎security/capability.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ static int cap_path_truncate(struct path *path)
279279
return 0;
280280
}
281281

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)
284283
{
285284
return 0;
286285
}

‎security/security.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,11 @@ int security_path_truncate(struct path *path)
454454
return security_ops->path_truncate(path);
455455
}
456456

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)
459458
{
460-
if (unlikely(IS_PRIVATE(dentry->d_inode)))
459+
if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
461460
return 0;
462-
return security_ops->path_chmod(dentry, mnt, mode);
461+
return security_ops->path_chmod(path, mode);
463462
}
464463

465464
int security_path_chown(struct path *path, uid_t uid, gid_t gid)

‎security/tomoyo/tomoyo.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,17 +353,14 @@ static int tomoyo_file_ioctl(struct file *file, unsigned int cmd,
353353
/**
354354
* tomoyo_path_chmod - Target for security_path_chmod().
355355
*
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.
359358
*
360359
* Returns 0 on success, negative value otherwise.
361360
*/
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)
364362
{
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,
367364
mode & S_IALLUGO);
368365
}
369366

0 commit comments

Comments
 (0)