Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Get the key quota record for a user, allocating a new record if one doesn't* already exist.

Proto:struct key_user *key_user_lookup(kuid_t uid)

Type:struct key_user

Parameter:

TypeParameterName
kuid_tuid
52  candidate = NULL
55  try_again :
56  parent = NULL
57  p = rb_node
58  spin_lock( & key_user_lock)
61  When p cycle
62  parent = p
63  user = rb_entry(parent, structkey_user, node)
65  If uid_lt(uid, uid) Then p = rb_left
67  Else if uid_gt(uid, uid) Then p = rb_right
69  Else Go to found
74  If Not candidate Then
77  spin_unlock( & key_user_lock)
79  user = NULL
80  candidate = Allocation memory
81  If Value for the false possibility is greater at compile time(!candidate) Then Go to out
87  Go to try_again
92  _set - set a refcount's value*@r: the refcount*@n: value to which the refcount will be set
93  atomic_set( & umber of keys , 0)
94  atomic_set( & umber of instantiated keys , 0)
95  uid = uid
96  umber of keys allocated to this user = 0
97  umber of bytes allocated to this user = 0
98  Process spin lock initialization( & lock)
99  mutex_init - initialize the mutex*@mutex: the mutex to be initialized* Initialize the mutex to unlocked state.* It is not allowed to initialize an already locked mutex.( & construction initiation lock )
101  rb_link_node( & node, parent, p)
102  rb_insert_color( & node, & ree of quota records indexed by UID )
103  spin_unlock( & key_user_lock)
104  user = candidate
105  Go to out
108  found :
109  _inc - increment a refcount*@r: the refcount to increment* Similar to atomic_inc(), but will saturate at REFCOUNT_SATURATED and WARN
110  spin_unlock( & key_user_lock)
111  kfree(candidate)
112  out :
113  Return user
Caller
NameDescribe
key_allockey_alloc - Allocate a key of the specified type.*@type: The type of key to allocate.*@desc: The key description to allow the key to be searched out.*@uid: The owner of the new key.*@gid: The group ID for the new key's group permissions.
keyctl_chown_keyChange the ownership of a key* The key must grant the caller Setattr permission for this to work, though* the key need not be fully instantiated yet. For the UID to be changed, or* for the GID to be changed to a group the caller is not a member of, the
construct_key_and_linkCommence key construction.