git: 13d39efedb32 - stable/14 - blake2: Remove dieing flag and rw lock
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 Dec 2023 23:09:01 UTC
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=13d39efedb32b31a49d4d1f1176200e993708124 commit 13d39efedb32b31a49d4d1f1176200e993708124 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-08-28 23:24:42 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-12-29 21:49:42 +0000 blake2: Remove dieing flag and rw lock crypto_unregister_all already disables new sessions and waits for existing sessions to be destroyed before returning. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D41581 (cherry picked from commit 79aeecc89f5c740f2a3b0c30238233d2a6bb7ec7) --- sys/crypto/blake2/blake2_cryptodev.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/sys/crypto/blake2/blake2_cryptodev.c b/sys/crypto/blake2/blake2_cryptodev.c index 755ac12c5d78..5c3ec07d7de7 100644 --- a/sys/crypto/blake2/blake2_cryptodev.c +++ b/sys/crypto/blake2/blake2_cryptodev.c @@ -29,11 +29,9 @@ #include <sys/bus.h> #include <sys/kernel.h> #include <sys/kobj.h> -#include <sys/lock.h> #include <sys/malloc.h> #include <sys/module.h> #include <sys/mutex.h> -#include <sys/rwlock.h> #include <sys/smp.h> #include <blake2.h> @@ -49,9 +47,7 @@ struct blake2_session { CTASSERT((size_t)BLAKE2B_KEYBYTES > (size_t)BLAKE2S_KEYBYTES); struct blake2_softc { - bool dying; int32_t cid; - struct rwlock lock; }; static int blake2_cipher_setup(struct blake2_session *ses, @@ -84,7 +80,6 @@ blake2_attach(device_t dev) struct blake2_softc *sc; sc = device_get_softc(dev); - sc->dying = false; sc->cid = crypto_get_driverid(dev, sizeof(struct blake2_session), CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | @@ -94,8 +89,6 @@ blake2_attach(device_t dev) return (ENOMEM); } - rw_init(&sc->lock, "blake2_lock"); - return (0); } @@ -106,13 +99,8 @@ blake2_detach(device_t dev) sc = device_get_softc(dev); - rw_wlock(&sc->lock); - sc->dying = true; - rw_wunlock(&sc->lock); crypto_unregister_all(sc->cid); - rw_destroy(&sc->lock); - return (0); } @@ -142,21 +130,11 @@ static int blake2_newsession(device_t dev, crypto_session_t cses, const struct crypto_session_params *csp) { - struct blake2_softc *sc; struct blake2_session *ses; int error; - sc = device_get_softc(dev); - ses = crypto_get_driver_session(cses); - rw_rlock(&sc->lock); - if (sc->dying) { - rw_runlock(&sc->lock); - return (EINVAL); - } - rw_runlock(&sc->lock); - error = blake2_cipher_setup(ses, csp); if (error != 0) { CRYPTDEB("setup failed");