Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\request_key.c Create Date:2022-07-28 18:23:41
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Commence key construction.

Proto:static struct key *construct_key_and_link(struct keyring_search_context *ctx, const char *callout_info, size_t callout_len, void *aux, struct key *dest_keyring, unsigned long flags)

Type:struct key

Parameter:

TypeParameterName
struct keyring_search_context *ctx
const char *callout_info
size_tcallout_len
void *aux
struct key *dest_keyring
unsigned longflags
484  kenter("")
486  If type == key_type_keyring Then Return ERR_PTR( - EPERM)
489  ret = Get the appropriate destination keyring for the request.* The keyring selected is returned with an extra reference upon it which the* caller must release.
490  If ret Then Go to error
493  user = Get the key quota record for a user, allocating a new record if one doesn't* already exist.
494  If Not user Then
495  ret = -ENOMEM
496  Go to error_put_dest_keyring
499  ret = Allocate a new key in under-construction state and attempt to link it in to* the requested keyring.* May return a key that's already under construction instead if there was a* race between two thread calling request_key().
500  Dispose of a user structure
502  If ret == 0 Then
503  ret = Call out to userspace for key construction.* Program failure is ignored in favour of key status.
505  If ret < 0 Then
506  kdebug("cons failed")
507  Go to construction_failed
509  Else if ret == -EINPROGRESS Then
510  ret = 0
511  Else
512  Go to error_put_dest_keyring
515  key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
516  kleave(" = key %d", key_serial(key))
517  Return key
519  construction_failed :
520  key_negate_and_link(key, default timeout on a negative key's existence , NULL, NULL)
521  key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
522  error_put_dest_keyring :
523  key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
524  error :
525  kleave(" = %d", ret)
526  Return ERR_PTR(ret)
Caller
NameDescribe
request_key_and_linkquest_key_and_link - Request a key and cache it in a keyring.*@type: The type of key we want.*@description: The searchable description of the key.*@domain_tag: The domain in which the key operates.