Module Name:    src
Committed By:   riastradh
Date:           Thu May 19 20:51:59 UTC 2022

Modified Files:
        src/sys/opencrypto: crypto.c

Log Message:
opencrypto: Assert !cpu_intr_p() on dispatch and invoke.

These should only ever have been potentially called from hard
interrupt context by CRYPTO_F_CBIMM callbacks (CBIMM = call back
immediately).  CRYPTO_F_CBIMM is no more, so there is no more need to
allow this case of call from hard interrupt context.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/opencrypto/crypto.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/opencrypto/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.118 src/sys/opencrypto/crypto.c:1.119
--- src/sys/opencrypto/crypto.c:1.118	Thu May 19 20:51:46 2022
+++ src/sys/opencrypto/crypto.c	Thu May 19 20:51:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.118 2022/05/19 20:51:46 riastradh Exp $ */
+/*	$NetBSD: crypto.c,v 1.119 2022/05/19 20:51:59 riastradh Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $	*/
 /*	$OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $	*/
 
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.118 2022/05/19 20:51:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.119 2022/05/19 20:51:59 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/reboot.h>
@@ -1264,6 +1264,7 @@ crypto_dispatch(struct cryptop *crp)
 	struct crypto_crp_q *crp_q;
 
 	KASSERT(crp != NULL);
+	KASSERT(!cpu_intr_p());
 
 	DPRINTF("crp %p, alg %d\n", crp, crp->crp_desc->crd_alg);
 
@@ -1373,6 +1374,7 @@ crypto_kdispatch(struct cryptkop *krp)
 	struct crypto_crp_kq *crp_kq;
 
 	KASSERT(krp != NULL);
+	KASSERT(!cpu_intr_p());
 
 	cryptostats.cs_kops++;
 
@@ -1439,6 +1441,7 @@ crypto_kinvoke(struct cryptkop *krp, int
 	int error;
 
 	KASSERT(krp != NULL);
+	KASSERT(!cpu_intr_p());
 
 	/* Sanity checks. */
 	if (krp->krp_callback == NULL) {
@@ -1524,6 +1527,7 @@ crypto_invoke(struct cryptop *crp, int h
 	struct cryptocap *cap;
 
 	KASSERT(crp != NULL);
+	KASSERT(!cpu_intr_p());
 
 #ifdef CRYPTO_TIMING
 	if (crypto_timing)

Reply via email to