The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.33.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.33.3
------>
commit fdbfb1c0a4a553def2a3103e9500e842d3cd8072
Author: Seth Forshee <[email protected]>
Date:   Tue Jul 11 19:39:38 2017 +0400

    ms/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 <[email protected]>
    Acked-by: Serge Hallyn <[email protected]>
    Signed-off-by: Eric W. Biederman <[email protected]>
    (cherry picked from commit 2d7f9e2ad35e4e7a3086231f19bfab33c6a8a64a)
    
    https://jira.sw.ru/browse/PSBM-40075
    
    Signed-off-by: Konstantin Khorenko <[email protected]>
---
 fs/namei.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/namei.c b/fs/namei.c
index ede7535..1ee459f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -803,6 +803,7 @@ static inline int may_follow_link(struct path *link, struct 
nameidata *nd)
 {
        const struct inode *inode;
        const struct inode *parent;
+       kuid_t puid;
 
        if (!sysctl_protected_symlinks)
                return 0;
@@ -818,7 +819,8 @@ static inline int may_follow_link(struct path *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;
 
        audit_log_link_denied("follow_link", link);
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to