Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\keyctl.c Create Date:2022-07-28 18:20:03
Last Modify:2020-03-18 07:59:52 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Search the specified keyring and any keyrings it links to for a matching* key

Proto:long keyctl_keyring_search(key_serial_t ringid, const char __user *_type, const char __user *_description, key_serial_t destringid)

Type:long

Parameter:

TypeParameterName
key_serial_tringid
const char __user *_type
const char __user *_description
key_serial_tdestringid
727  ret = key_get_type_from_user(type, _type, size of type )
728  If ret < 0 Then Go to error
731  description = strndup_user - duplicate an existing string from user space*@s: The string to duplicate*@n: Maximum number of bytes to copy, including the trailing NUL.* Return: newly allocated copy of @s or an ERR_PTR() in case of error
732  If IS_ERR(description) Then
733  ret = PTR_ERR(description)
734  Go to error
738  keyring_ref = Look up a key ID given us by userspace with a given permissions mask to get* the key it refers to.* Flags can be passed to request that special keyrings be created if referred* to directly, to permit partially constructed keys to be found and to skip
739  If IS_ERR(keyring_ref) Then
740  ret = PTR_ERR(keyring_ref)
741  Go to error2
745  dest_ref = NULL
746  If destringid Then
747  dest_ref = Look up a key ID given us by userspace with a given permissions mask to get* the key it refers to.* Flags can be passed to request that special keyrings be created if referred* to directly, to permit partially constructed keys to be found and to skip
749  If IS_ERR(dest_ref) Then
750  ret = PTR_ERR(dest_ref)
751  Go to error3
756  ktype = Find and lock the specified key type against removal.* We return with the sem read-locked if successful. If the type wasn't* available -ENOKEY is returned instead.
757  If IS_ERR(ktype) Then
758  ret = PTR_ERR(ktype)
759  Go to error4
763  key_ref = keyring_search - Search the supplied keyring tree for a matching key*@keyring: The root of the keyring tree to be searched
764  If IS_ERR(key_ref) Then
765  ret = PTR_ERR(key_ref)
768  If ret == -EAGAIN Then ret = -ENOKEY
770  Go to error5
774  If dest_ref Then
775  ret = Check to see whether permission is granted to use a key in the desired way.
776  If ret < 0 Then Go to error6
779  ret = key_link - Link a key to a keyring*@keyring: The keyring to make the link in
780  If ret < 0 Then Go to error6
784  ret = key serial number
786  error6 :
787  key_ref_put(key_ref)
788  error5 :
789  Unlock a key type locked by key_type_lookup().
790  error4 :
791  key_ref_put(dest_ref)
792  error3 :
793  key_ref_put(keyring_ref)
794  error2 :
795  kfree(description)
796  error :
797  Return ret
Caller
NameDescribe
SYSCALL_DEFINE5The key control system call
COMPAT_SYSCALL_DEFINE5The key control system call, 32-bit compatibility version for 64-bit archs