Patch "crypto: mcryptd - Check mcryptd algorithm compatibility" has been added to the 4.8-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
crypto: mcryptd - Check mcryptd algorithm compatibility
to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
crypto-mcryptd-check-mcryptd-algorithm-compatibility.patch
and it can be found in the queue-4.8 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
48a992727d82cb7db076fa15d372178743b1f4cdMon Sep 17 00:00:00 2001
From: tim <[email protected]>
Date: Mon, 5 Dec 2016 11:46:31 -0800
Subject: crypto: mcryptd - Check mcryptd algorithm compatibility
From: tim <[email protected]>
commit 48a992727d82cb7db076fa15d372178743b1f4cd upstream.
Algorithms not compatible with mcryptd could be spawned by mcryptd with a direct crypto_alloc_tfm invocation using a "mcryptd(alg)" name construct. This causes mcryptd to crash the kernel if an arbitrary "alg" is incompatible and not intended to be used with mcryptd. It is an issue if AF_ALG tries to spawn mcryptd(alg) to expose it externally. But such algorithms must be used internally and not be exposed.
We added a check to enforce that only internal algorithms are allowed with mcryptd at the time mcryptd is spawning an algorithm.
--- crypto/mcryptd.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
crypto/mcryptd.c +12 -7
@@ -254,18 +254,22 @@ out_free_inst: goto out; } -static inline void mcryptd_check_internal (struct rtattr **tb,u32 *type, +static inline bool mcryptd_check_internal (struct rtattr **tb,u32 *type,u32 *mask) {struct crypto_attr_type *algt; algt =crypto_get_attr_type (tb);if (IS_ERR (algt)) -return ; -if ((algt->type &CRYPTO_ALG_INTERNAL )) - *type |=CRYPTO_ALG_INTERNAL ; -if ((algt->mask &CRYPTO_ALG_INTERNAL )) - *mask |=CRYPTO_ALG_INTERNAL ; +return false; + + *type |= algt->type &CRYPTO_ALG_INTERNAL ; + *mask |= algt->mask &CRYPTO_ALG_INTERNAL ; + +if (*type & *mask &CRYPTO_ALG_INTERNAL ) +return true; +else +return false; }static int mcryptd_hash_init_tfm (struct crypto_tfm *tfm)
@@ -492,7 +496,8 @@ static int mcryptd_create_hash(struct cru32 mask =0 ;int err; -mcryptd_check_internal (tb, &type, &mask); +if (!mcryptd_check_internal (tb, &type, &mask)) +return -EINVAL ; halg =ahash_attr_alg (tb[1 ], type, mask);if (IS_ERR (halg))
Patches currently in stable-queue which might be from [email protected] are
queue-4.8/crypto-mcryptd-check-mcryptd-algorithm-compatibility.patch