From: Scott Mayhew <smayhew@redhat.com>
To: linux-nfs@vger.kernel.org, keyrings@vger.kernel.org
Subject: [RFC PATCH 1/5] keys: export keyring_ptr_to_key()
Date: Thu, 20 Apr 2023 16:20:00 -0400 [thread overview]
Message-ID: <20230420202004.239116-2-smayhew@redhat.com> (raw)
In-Reply-To: <20230420202004.239116-1-smayhew@redhat.com>
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(-)
diff --git a/include/linux/key.h b/include/linux/key.h
index 8dc7f7c3088b..3f4c6d6df921 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -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,
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index 4448758f643a..c57f3cef32fa 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -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)
--
2.39.2
next prev parent reply other threads:[~2023-04-20 20:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 20:19 [RFC PATCH 0/5] SUNRPC: Add option to store GSS credentials in Scott Mayhew
2023-04-20 20:20 ` Scott Mayhew [this message]
2023-04-20 20:20 ` [RFC PATCH 2/5] keys: add keyring_gc_custom() Scott Mayhew
2023-04-20 20:20 ` [RFC PATCH 3/5] keys: add dest_keyring parameter to request_key_with_auxdata() Scott Mayhew
2023-04-20 20:20 ` [RFC PATCH 4/5] keys: add the ability to search user keyrings in search_cred_keyrings_rcu() Scott Mayhew
2023-04-20 20:20 ` [RFC PATCH 5/5] SUNRPC: store GSS creds in keyrings Scott Mayhew
2023-04-20 21:54 ` kernel test robot
2023-04-21 3:32 ` kernel test robot
2023-04-21 5:14 ` kernel test robot
2023-04-21 6:15 ` kernel test robot
2023-04-21 10:13 ` Dan Carpenter
2023-04-22 21:27 ` Ben Boeckel
2023-04-24 14:02 ` Scott Mayhew
2023-04-24 14:23 ` Ben Boeckel
2023-04-24 15:01 ` Scott Mayhew
2023-04-24 18:28 ` Ben Boeckel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230420202004.239116-2-smayhew@redhat.com \
--to=smayhew@redhat.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.