From: James Morris Date: Mon, 9 Jan 2012 01:16:48 +0000 (+1100) Subject: Merge branch 'next' into for-linus X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8fcc99549522fc7a0bbaeb5755855ab0d9a59ce8;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git Merge branch 'next' into for-linus Conflicts: security/integrity/evm/evm_crypto.c Resolved upstream fix vs. next conflict manually. Signed-off-by: James Morris --- 8fcc99549522fc7a0bbaeb5755855ab0d9a59ce8 diff --cc security/integrity/evm/evm_crypto.c index 8738deff26fa,f1d4ad0cea2c..49a464f5595b --- a/security/integrity/evm/evm_crypto.c +++ b/security/integrity/evm/evm_crypto.c @@@ -29,21 -30,30 +30,30 @@@ struct crypto_shash *hash_tfm static DEFINE_MUTEX(mutex); - static struct shash_desc *init_desc(void) -static struct shash_desc *init_desc(const char type) ++static struct shash_desc *init_desc(char type) { - int rc; + long rc; + char *algo; + struct crypto_shash **tfm; struct shash_desc *desc; - if (hmac_tfm == NULL) { + if (type == EVM_XATTR_HMAC) { + tfm = &hmac_tfm; + algo = evm_hmac; + } else { + tfm = &hash_tfm; + algo = evm_hash; + } + + if (*tfm == NULL) { mutex_lock(&mutex); - if (hmac_tfm) + if (*tfm) goto out; - hmac_tfm = crypto_alloc_shash(evm_hmac, 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(hmac_tfm)) { - pr_err("Can not allocate %s (reason: %ld)\n", - evm_hmac, PTR_ERR(hmac_tfm)); - rc = PTR_ERR(hmac_tfm); - hmac_tfm = NULL; + *tfm = crypto_alloc_shash(algo, 0, CRYPTO_ALG_ASYNC); + if (IS_ERR(*tfm)) { + rc = PTR_ERR(*tfm); + pr_err("Can not allocate %s (reason: %ld)\n", algo, rc); + *tfm = NULL; mutex_unlock(&mutex); return ERR_PTR(rc); }