1
0
Fork 0

fs: Check for invalid i_uid in may_follow_link()

Filesystem uids which don't map into a user namespace may result
in inode->i_uid being INVALID_UID. A symlink and its parent
could have different owners in the filesystem can both get
mapped to INVALID_UID, which may result in following a symlink
when this would not have otherwise been permitted when protected
symlinks are enabled.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
steinar/wifi_calib_4_9_kernel
Seth Forshee 2016-04-26 14:36:23 -05:00 committed by Eric W. Biederman
parent 0d4d717f25
commit 2d7f9e2ad3
1 changed files with 3 additions and 1 deletions

View File

@ -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)