Re: [PATCH v2 3/3] s390/crypto: New s390 specific shash phmac

Herbert Xu
2024-11-05T23:24:51Z

On Tue, Nov 05, 2024 at 02:58:32PM +0100, Harald Freudenberger wrote:
>
> +static inline int s390_phmac_sha2_setkey(struct crypto_shash *tfm,
> + const u8 *key, unsigned int keylen)
> +{
> + struct s390_phmac_ctx *tfm_ctx = crypto_shash_ctx(tfm);
> + int rc = -ENOMEM;
> +
> + if (tfm_ctx->keylen) {
> + kfree_sensitive(tfm_ctx->key);
> + tfm_ctx->key = NULL;
> + tfm_ctx->keylen = 0;
> + }
> +
> + tfm_ctx->key = kmemdup(key, keylen, GFP_KERNEL);

Please use GFP_ATOMIC. GFP_KERNEL allocations are not allowed
in setkey.

Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt