]> www.infradead.org Git - users/jedix/linux-maple.git/commit
crypto: api - Allow delayed algorithm destruction
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 9 Apr 2025 03:29:03 +0000 (11:29 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 16 Apr 2025 07:16:22 +0000 (15:16 +0800)
commitd701722aa343e59dd7c18fc62894edf4497251e2
treea8bd81815656c5c01515c85ca35d0ebb712d1c04
parentc80d6598ffef3154698fb991c15211762cbf550e
crypto: api - Allow delayed algorithm destruction

The current algorithm unregistration mechanism originated from
software crypto.  The code relies on module reference counts to
stop in-use algorithms from being unregistered.  Therefore if
the unregistration function is reached, it is assumed that the
module reference count has hit zero and thus the algorithm reference
count should be exactly 1.

This is completely broken for hardware devices, which can be
unplugged at random.

Fix this by allowing algorithms to be destroyed later if a destroy
callback is provided.

Reported-by: Sean Anderson <sean.anderson@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/algapi.c