]> git.proxmox.com Git - mirror_ubuntu-bionic-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 04:31:00 +0000 (00:31 -0400)
commitcf16317ecf1589e0e8eda33e3bc62d9aae023a1f
tree9a3cc8aa8a5279d4efa92a1f5ae9759e9329b631
parent4a71c0b233a97ba98f29d63ff79f744dba725cbf
crypto: api - Fix race condition in crypto_spawn_alg

BugLink: https://bugs.launchpad.net/bugs/1866678
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