git: 70439285ad9d - main - crypto: hide crypto_destroyreq behind a tunable
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Feb 2022 07:48:34 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=70439285ad9d5ec8ebdb1cf8617e8f30ea31b2e2 commit 70439285ad9d5ec8ebdb1cf8617e8f30ea31b2e2 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2022-02-16 07:45:12 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2022-02-16 07:45:12 +0000 crypto: hide crypto_destroyreq behind a tunable Reviewed by: jhb, markj Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32084 --- sys/opencrypto/crypto.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 0b2c250a7af2..fde1316595e5 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -202,6 +202,13 @@ SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RWTUN, "Enable/disable use of software crypto by /dev/crypto"); #endif +#ifdef DIAGNOSTIC +bool crypto_destroyreq_check; +SYSCTL_BOOL(_kern_crypto, OID_AUTO, destroyreq_check, CTLFLAG_RWTUN, + &crypto_destroyreq_check, 0, + "Enable checks when destroying a request"); +#endif + MALLOC_DEFINE(M_CRYPTO_DATA, "crypto", "crypto session records"); static void crypto_dispatch_thread(void *arg); @@ -1580,6 +1587,9 @@ crypto_destroyreq(struct cryptop *crp) struct cryptop *crp2; struct crypto_ret_worker *ret_worker; + if (!crypto_destroyreq_check) + return; + CRYPTO_Q_LOCK(); TAILQ_FOREACH(crp2, &crp_q, crp_next) { KASSERT(crp2 != crp,