Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:add_master_key

Proto:static int add_master_key(struct super_block *sb, struct fscrypt_master_key_secret *secret, const struct fscrypt_key_specifier *mk_spec)

Type:int

Parameter:

TypeParameterName
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  If IS_ERR(key) Then
439  err = PTR_ERR(key)
440  If err != -ENOKEY Then Go to out_unlock
443  err = Create ->s_master_keys if needed. Synchronized by fscrypt_add_key_mutex.
444  If err Then Go to 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  Else
452  lock for writing
453  err = add_existing_master_key(data[0], secret)
454  lease a write lock
455  If err == KEY_DEAD Then
458  key_put(key)
459  Go to 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  Return err
Caller
NameDescribe
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