Skip to content

Commit 7318226

Browse files
dhowellsdavem330
authored andcommitted
[AF_RXRPC]: Key facility changes for AF_RXRPC
Export the keyring key type definition and document its availability. Add alternative types into the key's type_data union to make it more useful. Not all users necessarily want to use it as a list_head (AF_RXRPC doesn't, for example), so make it clear that it can be used in other ways. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 071b638 commit 7318226

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Documentation/keys.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,18 @@ payload contents" for more information.
859859
void unregister_key_type(struct key_type *type);
860860

861861

862+
Under some circumstances, it may be desirable to desirable to deal with a
863+
bundle of keys. The facility provides access to the keyring type for managing
864+
such a bundle:
865+
866+
struct key_type key_type_keyring;
867+
868+
This can be used with a function such as request_key() to find a specific
869+
keyring in a process's keyrings. A keyring thus found can then be searched
870+
with keyring_search(). Note that it is not possible to use request_key() to
871+
search a specific keyring, so using keyrings in this way is of limited utility.
872+
873+
862874
===================================
863875
NOTES ON ACCESSING PAYLOAD CONTENTS
864876
===================================

include/linux/key.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ struct key {
160160
*/
161161
union {
162162
struct list_head link;
163+
unsigned long x[2];
164+
void *p[2];
163165
} type_data;
164166

165167
/* key data

security/keys/keyring.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ struct key_type key_type_keyring = {
6666
.read = keyring_read,
6767
};
6868

69+
EXPORT_SYMBOL(key_type_keyring);
70+
6971
/*
7072
* semaphore to serialise link/link calls to prevent two link calls in parallel
7173
* introducing a cycle

0 commit comments

Comments
 (0)