summaryrefslogtreecommitdiffstats
path: root/kernel/cred.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-08-10 14:11:54 +0200
committerIngo Molnar <mingo@kernel.org>2016-08-10 14:11:54 +0200
commita2071cd765637002523798358d2ca441306d708b (patch)
treebafac1682bfa91457439cad09d2eeea71f2ad3bf /kernel/cred.c
parent784bdf3bb694b256fcd6120b93e8947a84249a3a (diff)
parenta0cba2179ea4c1820fce2ee046b6ed90ecc56196 (diff)
downloadlinux-a2071cd765637002523798358d2ca441306d708b.tar.bz2
Merge branch 'linus' into locking/urgent, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/cred.c')
-rw-r--r--kernel/cred.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/cred.c b/kernel/cred.c
index 0c0cd8a62285..5f264fb5737d 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -689,6 +689,8 @@ EXPORT_SYMBOL(set_security_override_from_ctx);
*/
int set_create_files_as(struct cred *new, struct inode *inode)
{
+ if (!uid_valid(inode->i_uid) || !gid_valid(inode->i_gid))
+ return -EINVAL;
new->fsuid = inode->i_uid;
new->fsgid = inode->i_gid;
return security_kernel_create_files_as(new, inode);