diff options
author | Toke Høiland-Jørgensen <toke@redhat.com> | 2023-03-13 12:17:24 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-05-11 17:03:02 +0300 |
commit | 42ca037d0c3fc4f7bb2ae2b47b6ea9ef59065fab (patch) | |
tree | ff0fe1147143e3e867aefc01c6fc6d6427d15a1f /drivers/crypto/inside-secure/safexcel.c | |
parent | d9834abd8b24d1fe8092859e436fe1e0fd467c61 (diff) | |
download | linux-42ca037d0c3fc4f7bb2ae2b47b6ea9ef59065fab.tar.xz |
crypto: api - Demote BUG_ON() in crypto_unregister_alg() to a WARN_ON()
commit a543ada7db729514ddd3ba4efa45f4c7b802ad85 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/crypto/inside-secure/safexcel.c')
0 files changed, 0 insertions, 0 deletions