Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\crypto\policy.c Create Date:2022-07-28 20:24:14
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:fscrypt_ioctl_set_policy

Proto:int fscrypt_ioctl_set_policy(struct file *filp, const void __user *arg)

Type:int

Parameter:

TypeParameterName
struct file *filp
const void __user *arg
316  inode = file_inode(filp)
321  If Get a simple variable from user space(version, (constu8__user * )arg) Then Return -EFAULT
324  size = Return the size expected for the given fscrypt_policy based on its version* number, or 0 if the policy version is unrecognized.
325  If size <= 0 Then Return -EINVAL
339  version = version
340  If copy_from_user( & policy, arg, size) Then Return -EFAULT
342  version = version
344  If Not de_owner_or_capable - check current task permissions to inode*@inode: inode being checked* Return true if current either has CAP_FOWNER in a namespace with the* inode owner uid mapped, or owns the file. Then Return -EACCES
347  ret = mnt_want_write_file - get write access to a file's mount*@file: the file who's mount on which to take a write* This is like mnt_want_write, but it takes a file and can* do some optimisations if the file is open for write already
348  If ret Then Return ret
351  inode_lock(inode)
353  ret = fscrypt_get_policy(inode, & existing_policy)
354  If ret == -ENODATA Then
355  If Not S_ISDIR(i_mode) Then ret = -ENOTDIR
357  Else if IS_DEADDIR(inode) Then ret = -ENOENT
359  Else if Not empty_dir(inode) Then ret = -ENOTEMPTY
361  Else ret = set_encryption_policy(inode, & policy)
363  Else if ret == -EINVAL || ret == 0 && Not scrypt_policies_equal - check whether two encryption policies are the same* Return: %true if equal, else %false Then
367  ret = -EEXIST
370  inode_unlock(inode)
372  mnt_drop_write_file(filp)
373  Return ret