aboutsummaryrefslogtreecommitdiff
path: root/sys/opencrypto
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2022-07-01 15:09:39 +0000
committerMark Johnston <markj@FreeBSD.org>2022-07-01 15:09:39 +0000
commit99df914899f56efe63afd9e0fef79148fa6ca162 (patch)
tree8d621483753d2cc31565fac3fb3814d2ba5426e8 /sys/opencrypto
parent8179db52c2c8692cdabf818bf1b7fdf3ad43b2db (diff)
Diffstat (limited to 'sys/opencrypto')
-rw-r--r--sys/opencrypto/crypto.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index ff7ce0f9b818..7231b390302f 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -1527,6 +1527,7 @@ crypto_task_invoke(void *ctx, int pending)
static int
crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint)
{
+ int error;
KASSERT(crp != NULL, ("%s: crp == NULL", __func__));
KASSERT(crp->crp_callback != NULL,
@@ -1575,13 +1576,19 @@ crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint)
crp->crp_etype = EAGAIN;
crypto_done(crp);
- return 0;
+ error = 0;
} else {
/*
- * Invoke the driver to process the request.
+ * Invoke the driver to process the request. Errors are
+ * signaled by setting crp_etype before invoking the completion
+ * callback.
*/
- return CRYPTODEV_PROCESS(cap->cc_dev, crp, hint);
+ error = CRYPTODEV_PROCESS(cap->cc_dev, crp, hint);
+ KASSERT(error == 0 || error == ERESTART,
+ ("%s: invalid error %d from CRYPTODEV_PROCESS",
+ __func__, error));
}
+ return (error);
}
void