函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\crypto\keyring.c Create Date:2022-07-29 10:57:21
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:add_master_key

函数原型:static int add_master_key(struct super_block *sb, struct fscrypt_master_key_secret *secret, const struct fscrypt_key_specifier *mk_spec)

返回类型:int

参数:

类型参数名称
struct super_block *sb
struct fscrypt_master_key_secret *secret
const struct fscrypt_key_specifier *mk_spec
431  DEFINE_MUTEX(fscrypt_add_key_mutex)
435  mutex_lock( & fscrypt_add_key_mutex)
436  retry :
437  key等于Find the specified master key in ->s_master_keys.* Returns ERR_PTR(-ENOKEY) if not found.
438  如果是错误
439  err等于错误
440  如果err不等于负ENOKEY则转到:out_unlock
443  err等于Create ->s_master_keys if needed. Synchronized by fscrypt_add_key_mutex.
444  如果err则转到:out_unlock
446  err等于Allocate a new fscrypt_master_key which contains the given secret, set it as* the payload of a new 'struct key' of type fscrypt, and link the 'struct key'* into the given keyring. Synchronized by fscrypt_add_key_mutex.
447  否则
452  lock for writing
453  err等于add_existing_master_key(data[0], secret)
454  lease a write lock
455  如果err恒等于KEY_DEAD
458  key_put(key)
459  转到:retry
461  key_put(key)
463  out_unlock :
464  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
465  返回:err
调用者
名称描述
fscrypt_ioctl_add_keyAdd a master encryption key to the filesystem, causing all files which were* encrypted with it to appear "unlocked" (decrypted) when accessed.* When adding a key for use by v1 encryption policies, this ioctl is