lkml.org 
[lkml]   [2018]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4] crc-t10dif: Pick better transform if one becomes available
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 <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

\
 
 \ /
  Last update: 2018-08-27 08:14    [W:0.112 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site