diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-05-18 20:03:45 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-05-18 20:03:45 +0000 |
| commit | 2bda5522b036e7678e0869f0808daf9b7b982f26 (patch) | |
| tree | 185f643033f542a7333b69035db694aab7058e25 /sys/opencrypto | |
| parent | 27e97e62f29c0f007acf36ccd2e4b9a198c4ded2 (diff) | |
crypto(4): Narrow scope of cryptodev_mtx to cover wait.
No functional change intended -- this only removes an unnecessary
lock/unlock cycle in the error case.
Diffstat (limited to 'sys/opencrypto')
| -rw-r--r-- | sys/opencrypto/cryptodev.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 3607b3c6de7..f4398799f17 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -1,4 +1,4 @@ -/* $NetBSD: cryptodev.c,v 1.110 2022/05/18 20:03:32 riastradh Exp $ */ +/* $NetBSD: cryptodev.c,v 1.111 2022/05/18 20:03:45 riastradh Exp $ */ /* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */ /* $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $ */ @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.110 2022/05/18 20:03:32 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.111 2022/05/18 20:03:45 riastradh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -653,7 +653,6 @@ cryptodev_op(struct csession *cse, struct crypt_op *cop, struct lwp *l) cv_init(&crp->crp_cv, "crydev"); error = crypto_dispatch(crp); - mutex_enter(&cryptodev_mtx); /* * Don't touch crp before returned by any error or received @@ -665,11 +664,11 @@ cryptodev_op(struct csession *cse, struct crypt_op *cop, struct lwp *l) break; default: DPRINTF("not waiting, error.\n"); - mutex_exit(&cryptodev_mtx); cv_destroy(&crp->crp_cv); goto bail; } + mutex_enter(&cryptodev_mtx); while (!(crp->crp_devflags & CRYPTODEV_F_RET)) { DPRINTF("cse->sid[%d]: sleeping on cv %p for crp %p\n", (uint32_t)cse->sid, &crp->crp_cv, crp); |
