|
@@ -901,6 +901,7 @@ static inline int may_follow_link(struct nameidata *nd)
|
|
|
{
|
|
|
const struct inode *inode;
|
|
|
const struct inode *parent;
|
|
|
+ kuid_t puid;
|
|
|
|
|
|
if (!sysctl_protected_symlinks)
|
|
|
return 0;
|
|
@@ -916,7 +917,8 @@ static inline int may_follow_link(struct nameidata *nd)
|
|
|
return 0;
|
|
|
|
|
|
/* Allowed if parent directory and link owner match. */
|
|
|
- if (uid_eq(parent->i_uid, inode->i_uid))
|
|
|
+ puid = parent->i_uid;
|
|
|
+ if (uid_valid(puid) && uid_eq(puid, inode->i_uid))
|
|
|
return 0;
|
|
|
|
|
|
if (nd->flags & LOOKUP_RCU)
|