[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20160912152128.980769300@linuxfoundation.org>
Date: Mon, 12 Sep 2016 17:29:25 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Seth Forshee <seth.forshee@...onical.com>,
Serge Hallyn <serge.hallyn@...onical.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: [PATCH 4.7 05/59] fs: Check for invalid i_uid in may_follow_link()
4.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Forshee <seth.forshee@...onical.com>
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 <seth.forshee@...onical.com>
Acked-by: Serge Hallyn <serge.hallyn@...onical.com>
Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
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)
Powered by blists - more mailing lists