[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240821123616.60401-5-dhowells@redhat.com>
Date: Wed, 21 Aug 2024 13:36:12 +0100
From: David Howells <dhowells@...hat.com>
To: Jarkko Sakkinen <jarkko@...nel.org>
Cc: David Howells <dhowells@...hat.com>,
keyrings@...r.kernel.org,
linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 4/7] keys: Add a key_ref_get() wrapper
Add a key_ref_get() wrapper function to go with key_ref_put() and use it
for the place that needs it.
Signed-off-by: David Howells <dhowells@...hat.com>
cc: Jarkko Sakkinen <jarkko@...nel.org>
cc: keyrings@...r.kernel.org
cc: linux-security-module@...r.kernel.org
---
include/linux/key.h | 5 +++++
security/keys/keyring.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/linux/key.h b/include/linux/key.h
index 08062b4f807c..50a19e5f9e45 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -315,6 +315,11 @@ static inline void key_ref_put(key_ref_t key_ref)
key_put(key_ref_to_ptr(key_ref));
}
+static inline void key_ref_get(key_ref_t key_ref)
+{
+ key_get(key_ref_to_ptr(key_ref));
+}
+
extern struct key *request_key_tag(struct key_type *type,
const char *description,
struct key_tag *domain_tag,
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index 0eed018448cb..7f02b913c560 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -920,7 +920,7 @@ key_ref_t keyring_search_rcu(key_ref_t keyring_ref,
ctx->now = ktime_get_real_seconds();
if (search_nested_keyrings(keyring, ctx))
- __key_get(key_ref_to_ptr(ctx->result));
+ key_ref_get(ctx->result);
return ctx->result;
}
Powered by blists - more mailing lists