On Sat, Aug 25, 2018 at 07:40:04PM -0700, Martin K. Petersen wrote:
>
> +static int crc_t10dif_rehash(struct notifier_block *self, unsigned long val, 
> void *data)
> +{
> +     struct crypto_alg *alg = data;
> +     struct crypto_shash *new, *old;
> +
> +     if (val != CRYPTO_MSG_ALG_LOADED ||
> +         static_key_false(&crct10dif_fallback) ||
> +         strncmp(alg->cra_name, CRC_T10DIF_STRING, 
> strlen(CRC_T10DIF_STRING)))
> +             return 0;
> +
> +     spin_lock(&crc_t10dif_mutex);
> +     old = rcu_dereference_protected(crct10dif_tfm,
> +                                     lockdep_is_held(&crc_t10dif_mutex));
> +     if (!old) {
> +             spin_unlock(&crc_t10dif_mutex);
> +             return 0;
> +     }
> +     new = crypto_alloc_shash("crct10dif", 0, 0);

You cannot allocate crypto tfm objects while holding a spin lock
because they need to allocate memory with GFP_KERNEL.

How about using a mutex?

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

Reply via email to