On Mon, Mar 13, 2023 at 10:17:24AM +0100, Toke Høiland-Jørgensen wrote: > 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@xxxxxxx > Cc: stable@xxxxxxxxxxxxxxx > Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx> > --- > v2: > - Return early if the WARN_ON() triggers > > crypto/algapi.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Patch applied. Thanks. -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt