lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D3QWJWFPGR7Q.2XUGONFPC8B9S@kernel.org>
Date: Tue, 27 Aug 2024 21:23:39 +0300
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "David Howells" <dhowells@...hat.com>
Cc: <keyrings@...r.kernel.org>, <linux-security-module@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/7] keys: Add a key_ref_get() wrapper

On Wed Aug 21, 2024 at 3:36 PM EEST, David Howells wrote:
> 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;
>  }
>  

Reviewed-by: Jarkko Sakkinen <jarkko@...nel.org>

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ