@@ -417,6 +417,8 @@ extern int key_move(struct key *key,
extern int key_unlink(struct key *keyring,
struct key *key);
+extern inline struct key *keyring_ptr_to_key(const struct assoc_array_ptr *x);
+
extern struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid,
const struct cred *cred,
key_perm_t perm,
@@ -37,11 +37,14 @@ static inline bool keyring_ptr_is_keyring(const struct assoc_array_ptr *x)
{
return (unsigned long)x & KEYRING_PTR_SUBTYPE;
}
-static inline struct key *keyring_ptr_to_key(const struct assoc_array_ptr *x)
+
+inline struct key *keyring_ptr_to_key(const struct assoc_array_ptr *x)
{
void *object = assoc_array_ptr_to_leaf(x);
return (struct key *)((unsigned long)object & ~KEYRING_PTR_SUBTYPE);
}
+EXPORT_SYMBOL_GPL(keyring_ptr_to_key);
+
static inline void *keyring_key_to_ptr(struct key *key)
{
if (key->type == &key_type_keyring)
We want to be able to garbage collect keyrings using a custom select iterator, which will need to use keyring_ptr_to_key(). Signed-off-by: Scott Mayhew <smayhew@redhat.com> --- include/linux/key.h | 2 ++ security/keys/keyring.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-)