[PATCH 1/2] keys: request_key: replace BUG with return -EINVAL

Jarkko Sakkinen jarkko at kernel.org
Mon Jun 15 12:06:18 UTC 2026


On Sat, Jun 13, 2026 at 02:04:07PM +0100, Mohammed EL Kadiri wrote:
> Replace BUG() in construct_get_dest_keyring() default case
> with return -EINVAL to handle the unimplemented group keyring
> destination gracefully.
> 
> Signed-off-by: Mohammed EL Kadiri <med08elkadiri at gmail.com>
> ---
>  security/keys/request_key.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/keys/request_key.c b/security/keys/request_key.c
> index a7673ad86d18..fa2bb9f2f538 100644
> --- a/security/keys/request_key.c
> +++ b/security/keys/request_key.c
> @@ -332,7 +332,7 @@ static int construct_get_dest_keyring(struct key **_dest_keyring)
>  
>  		case KEY_REQKEY_DEFL_GROUP_KEYRING:
>  		default:
> -			BUG();
> +			return -EINVAL;
>  		}
>  
>  		/*
> -- 
> 2.43.0
> 

Reviewed-by: Jarkko Sakkinen <jarkko at kernel.org>

BR, Jarkko



More information about the Linux-security-module-archive mailing list