]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
crypto: api - Fix race condition in crypto_spawn_alg
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 7 Dec 2019 14:15:15 +0000 (22:15 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 13 Mar 2020 05:19:20 +0000 (01:19 -0400)
commitbf60db38e462aa9d8457b31e4324079d347ac840
tree58d8367c3c46405e5959edaf89314966f56394d2
parentc2a44d626d50bd66b053c6073da3778b7ddc57de
crypto: api - Fix race condition in crypto_spawn_alg

BugLink: https://bugs.launchpad.net/bugs/1867051
commit 73669cc556462f4e50376538d77ee312142e8a8a upstream.

The function crypto_spawn_alg is racy because it drops the lock
before shooting the dying algorithm.  The algorithm could disappear
altogether before we shoot it.

This patch fixes it by moving the shooting into the locked section.

Fixes: 6bfd48096ff8 ("[CRYPTO] api: Added spawns")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
crypto/algapi.c
crypto/api.c
crypto/internal.h