[Devel] [PATCH RHEL7 COMMIT] ms/cred: Reject inodes with invalid ids in set_create_file_as()
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Jul 11 18:39:39 MSK 2017
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 c8e3c4c433fa08bca9633481085ec888e3c308b1
Author: Seth Forshee <seth.forshee at canonical.com>
Date: Tue Jul 11 19:39:39 2017 +0400
ms/cred: Reject inodes with invalid ids in set_create_file_as()
Using INVALID_[UG]ID for the LSM file creation context doesn't
make sense, so return an error if the inode passed to
set_create_file_as() has an invalid id.
Signed-off-by: Seth Forshee <seth.forshee at canonical.com>
Acked-by: Serge Hallyn <serge.hallyn at canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm at xmission.com>
(cherry picked from commit 5f65e5ca286126a60f62c8421b77c2018a482b8a)
https://jira.sw.ru/browse/PSBM-40075
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
kernel/cred.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/cred.c b/kernel/cred.c
index eb7c547..f6bd635 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -682,6 +682,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);
More information about the Devel
mailing list