This is a note to let you know that I've just added the patch titled crypto: api - Check spawn->alg under lock in crypto_drop_spawn to the 4.19-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-api-check-spawn-alg-under-lock-in-crypto_drop_spawn.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 7db3b61b6bba4310f454588c2ca6faf2958ad79f Mon Sep 17 00:00:00 2001 From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Date: Fri, 6 Dec 2019 13:55:17 +0800 Subject: crypto: api - Check spawn->alg under lock in crypto_drop_spawn From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> commit 7db3b61b6bba4310f454588c2ca6faf2958ad79f upstream. We need to check whether spawn->alg is NULL under lock as otherwise the algorithm could be removed from under us after we have checked it and found it to be non-NULL. This could cause us to remove the spawn from a non-existent list. Fixes: 7ede5a5ba55a ("crypto: api - Fix crypto_drop_spawn crash...") Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- crypto/algapi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -649,11 +649,9 @@ EXPORT_SYMBOL_GPL(crypto_grab_spawn); void crypto_drop_spawn(struct crypto_spawn *spawn) { - if (!spawn->alg) - return; - down_write(&crypto_alg_sem); - list_del(&spawn->list); + if (spawn->alg) + list_del(&spawn->list); up_write(&crypto_alg_sem); } EXPORT_SYMBOL_GPL(crypto_drop_spawn); Patches currently in stable-queue which might be from herbert@xxxxxxxxxxxxxxxxxxx are queue-4.19/crypto-ccree-fix-pm-race-condition.patch queue-4.19/crypto-api-check-spawn-alg-under-lock-in-crypto_drop_spawn.patch queue-4.19/crypto-geode-aes-convert-to-skcipher-api-and-make-thread-safe.patch queue-4.19/crypto-ccree-fix-backlog-memory-leak.patch queue-4.19/crypto-ccree-fix-pm-wrongful-error-reporting.patch