mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
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@canonical.com> Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
This commit is contained in:
parent
2d7f9e2ad3
commit
5f65e5ca28
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user