From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:35301 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbcIINr4 (ORCPT ); Fri, 9 Sep 2016 09:47:56 -0400 Subject: Patch "fs: Check for invalid i_uid in may_follow_link()" has been added to the 4.7-stable tree To: seth.forshee@canonical.com, ebiederm@xmission.com, gregkh@linuxfoundation.org, serge.hallyn@canonical.com Cc: , From: Date: Fri, 09 Sep 2016 15:47:53 +0200 Message-ID: <1473428873141253@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled fs: Check for invalid i_uid in may_follow_link() to the 4.7-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: fs-check-for-invalid-i_uid-in-may_follow_link.patch and it can be found in the queue-4.7 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From 2d7f9e2ad35e4e7a3086231f19bfab33c6a8a64a Mon Sep 17 00:00:00 2001 From: Seth Forshee Date: Tue, 26 Apr 2016 14:36:23 -0500 Subject: fs: Check for invalid i_uid in may_follow_link() From: Seth Forshee commit 2d7f9e2ad35e4e7a3086231f19bfab33c6a8a64a upstream. 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 Acked-by: Serge Hallyn Signed-off-by: Eric W. Biederman Signed-off-by: Greg Kroah-Hartman --- fs/namei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/namei.c +++ b/fs/namei.c @@ -901,6 +901,7 @@ static inline int may_follow_link(struct { 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 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) Patches currently in stable-queue which might be from seth.forshee@canonical.com are queue-4.7/cred-reject-inodes-with-invalid-ids-in-set_create_file_as.patch queue-4.7/fs-check-for-invalid-i_uid-in-may_follow_link.patch