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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 27 Aug 2018 14:13:26 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     "Martin K. Petersen" <martin.petersen@...cle.com>
Cc:     Jeff.Lien@....com, ard.biesheuvel@...aro.org,
        david.darrington@....com, hch@...radead.org, jeff.furlong@....com,
        linux-block@...r.kernel.org, linux-crypto@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
        tim.c.chen@...ux.intel.com
Subject: Re: [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@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ