aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 757a32725d92..8701bd9a5270 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -901,6 +901,7 @@ static inline int may_follow_link(struct nameidata *nd)
901{ 901{
902 const struct inode *inode; 902 const struct inode *inode;
903 const struct inode *parent; 903 const struct inode *parent;
904 kuid_t puid;
904 905
905 if (!sysctl_protected_symlinks) 906 if (!sysctl_protected_symlinks)
906 return 0; 907 return 0;
@@ -916,7 +917,8 @@ static inline int may_follow_link(struct nameidata *nd)
916 return 0; 917 return 0;
917 918
918 /* Allowed if parent directory and link owner match. */ 919 /* Allowed if parent directory and link owner match. */
919 if (uid_eq(parent->i_uid, inode->i_uid)) 920 puid = parent->i_uid;
921 if (uid_valid(puid) && uid_eq(puid, inode->i_uid))
920 return 0; 922 return 0;
921 923
922 if (nd->flags & LOOKUP_RCU) 924 if (nd->flags & LOOKUP_RCU)