Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> writes: > On Thu, Mar 09, 2023 at 03:51:22PM +0100, Toke Høiland-Jørgensen wrote: >> Hi folks >> >> I'm hitting what appears to be a deliberate BUG_ON() in >> crypto_unregister_alg() when rebooting my traverse ten64 device on a >> 6.2.2 kernel (using the Arch linux-aarch64 build, which is basically an >> upstream kernel). >> >> Any idea what might be causing this? It does not appear on an older >> (5.17, which is the newest kernel that works reliably, for unrelated >> reasons). > > On the face of it this looks like a generic issue with drivers > and the Crypto API. Historically crypto modules weren't meant > to be removed/unregistered until the last user has freed the tfm. > > Obviously with drivers that start unregistering the algorithms when > the hardware goes away this paradigm breaks. What should happen is > that the driver continues to hold onto the crypto algorithm registration > even when the hardware has gone away. > > Some work has to be done in the driver to actually make this safe > (all the drivers I've looked at are broken in this way). Hmm, okay; any idea why this started happening with the newer kernel version? I don't see any changes to the driver that could have caused this; so is it some core-kernel change that has changed the order of driver removal on shutdown or something? Also, absent of a fixed driver (which doesn't sound like it's a trivial fix?), how do I prevent the system from crashing on shutdown? The BUG_ON() seems a bit heavy-handed, could it be replaced with a WARN_ON? -Toke