crypto: Validate return values from CRYPTODEV_PROCESS()

Errors are always handled by the completion callback, so we should check
that they're not also passed back to the caller.

No functional change intended.

Reviewed by:	kp, mav, jhb
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35382
This commit is contained in:
Mark Johnston 2022-07-01 11:09:39 -04:00
parent 8179db52c2
commit 99df914899

View file

@ -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