summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-05-06 15:58:18 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-05-10 22:20:18 -0400
commitfec2fa24e84a75447341a20d36e808c8d913a81a (patch)
tree326d81be05554af37e110cc676ef95bc81d6b490 /fs/namei.c
parentcd179f4468acfda2b7e9e236dc37bba815996421 (diff)
may_follow_link(): trim arguments
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 05efcc0fc4b6..82cb1bc9a1bf 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -765,7 +765,6 @@ int sysctl_protected_hardlinks __read_mostly = 0;
765 765
766/** 766/**
767 * may_follow_link - Check symlink following for unsafe situations 767 * may_follow_link - Check symlink following for unsafe situations
768 * @link: The path of the symlink
769 * @nd: nameidata pathwalk data 768 * @nd: nameidata pathwalk data
770 * 769 *
771 * In the case of the sysctl_protected_symlinks sysctl being enabled, 770 * In the case of the sysctl_protected_symlinks sysctl being enabled,
@@ -779,7 +778,7 @@ int sysctl_protected_hardlinks __read_mostly = 0;
779 * 778 *
780 * Returns 0 if following the symlink is allowed, -ve on error. 779 * Returns 0 if following the symlink is allowed, -ve on error.
781 */ 780 */
782static inline int may_follow_link(struct path *link, struct nameidata *nd) 781static inline int may_follow_link(struct nameidata *nd)
783{ 782{
784 const struct inode *inode; 783 const struct inode *inode;
785 const struct inode *parent; 784 const struct inode *parent;
@@ -788,7 +787,7 @@ static inline int may_follow_link(struct path *link, struct nameidata *nd)
788 return 0; 787 return 0;
789 788
790 /* Allowed if owner and follower match. */ 789 /* Allowed if owner and follower match. */
791 inode = link->dentry->d_inode; 790 inode = nd->link.dentry->d_inode;
792 if (uid_eq(current_cred()->fsuid, inode->i_uid)) 791 if (uid_eq(current_cred()->fsuid, inode->i_uid))
793 return 0; 792 return 0;
794 793
@@ -801,8 +800,8 @@ static inline int may_follow_link(struct path *link, struct nameidata *nd)
801 if (uid_eq(parent->i_uid, inode->i_uid)) 800 if (uid_eq(parent->i_uid, inode->i_uid))
802 return 0; 801 return 0;
803 802
804 audit_log_link_denied("follow_link", link); 803 audit_log_link_denied("follow_link", &nd->link);
805 path_put(link); 804 path_put(&nd->link);
806 path_put(&nd->path); 805 path_put(&nd->path);
807 return -EACCES; 806 return -EACCES;
808} 807}
@@ -1985,7 +1984,7 @@ static void path_cleanup(struct nameidata *nd)
1985static int trailing_symlink(struct nameidata *nd) 1984static int trailing_symlink(struct nameidata *nd)
1986{ 1985{
1987 const char *s; 1986 const char *s;
1988 int error = may_follow_link(&nd->link, nd); 1987 int error = may_follow_link(nd);
1989 if (unlikely(error)) 1988 if (unlikely(error))
1990 return error; 1989 return error;
1991 nd->flags |= LOOKUP_PARENT; 1990 nd->flags |= LOOKUP_PARENT;