diff options
author | Toke Høiland-Jørgensen <toke@redhat.com> | 2023-03-13 10:17:24 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-03-24 18:22:28 +0800 |
commit | 10eb5ccf9823fb697da10e304c0ac6f90607daec (patch) | |
tree | 41e1b315e355a16a79ade454a08c17f0b16e3a40 /crypto/jitterentropy-kcapi.c | |
parent | 031dc4b72d5e3d2fb07dc721f9b338d65b723c7a (diff) | |
download | linux-crypto-10eb5ccf9823fb697da10e304c0ac6f90607daec.tar.gz linux-crypto-10eb5ccf9823fb697da10e304c0ac6f90607daec.zip |
crypto: api - Demote BUG_ON() in crypto_unregister_alg() to a WARN_ON()
The crypto_unregister_alg() function expects callers to ensure that any
algorithm that is unregistered has a refcnt of exactly 1, and issues a
BUG_ON() if this is not the case. However, there are in fact drivers that
will call crypto_unregister_alg() without ensuring that the refcnt has been
lowered first, most notably on system shutdown. This causes the BUG_ON() to
trigger, which prevents a clean shutdown and hangs the system.
To avoid such hangs on shutdown, demote the BUG_ON() in
crypto_unregister_alg() to a WARN_ON() with early return. Cc stable because
this problem was observed on a 6.2 kernel, cf the link below.
Link: https://lore.kernel.org/r/87r0tyq8ph.fsf@toke.dk
Cc: stable@vger.kernel.org
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/jitterentropy-kcapi.c')
0 files changed, 0 insertions, 0 deletions