svn commit: r365478 - in head/sys: crypto/armv8 dev/hifn dev/safe

John Baldwin jhb at FreeBSD.org
Tue Sep 8 22:41:36 UTC 2020


Author: jhb
Date: Tue Sep  8 22:41:35 2020
New Revision: 365478
URL: https://svnweb.freebsd.org/changeset/base/365478

Log:
  Don't return errors from the cryptodev_process() method.
  
  The cryptodev_process() method should either return 0 if it has
  completed a request, or ERESTART to defer the request until later.  If
  a request encounters an error, the error should be reported via
  crp_etype before completing the request via crypto_done().
  
  Fix a few more drivers noticed by asomers@ similar to the fix in
  r365389.  This is an old bug, but went unnoticed since crypto requests
  did not start failing as a normal part of operation until digest
  verification was introduced which can fail requests with EBADMSG.
  
  PR:		247986
  Reported by:	asomers
  Sponsored by:	Chelsio Communications
  Differential Revision:	https://reviews.freebsd.org/D26361

Modified:
  head/sys/crypto/armv8/armv8_crypto.c
  head/sys/dev/hifn/hifn7751.c
  head/sys/dev/safe/safe.c

Modified: head/sys/crypto/armv8/armv8_crypto.c
==============================================================================
--- head/sys/crypto/armv8/armv8_crypto.c	Tue Sep  8 22:23:53 2020	(r365477)
+++ head/sys/crypto/armv8/armv8_crypto.c	Tue Sep  8 22:41:35 2020	(r365478)
@@ -281,7 +281,7 @@ armv8_crypto_process(device_t dev, struct cryptop *crp
 out:
 	crp->crp_etype = error;
 	crypto_done(crp);
-	return (error);
+	return (0);
 }
 
 static uint8_t *

Modified: head/sys/dev/hifn/hifn7751.c
==============================================================================
--- head/sys/dev/hifn/hifn7751.c	Tue Sep  8 22:23:53 2020	(r365477)
+++ head/sys/dev/hifn/hifn7751.c	Tue Sep  8 22:41:35 2020	(r365478)
@@ -2517,7 +2517,7 @@ errout:
 		hifnstats.hst_nomem++;
 	crp->crp_etype = err;
 	crypto_done(crp);
-	return (err);
+	return (0);
 }
 
 static void

Modified: head/sys/dev/safe/safe.c
==============================================================================
--- head/sys/dev/safe/safe.c	Tue Sep  8 22:23:53 2020	(r365477)
+++ head/sys/dev/safe/safe.c	Tue Sep  8 22:41:35 2020	(r365478)
@@ -1259,6 +1259,7 @@ errout:
 	if (err != ERESTART) {
 		crp->crp_etype = err;
 		crypto_done(crp);
+		err = 0;
 	} else {
 		sc->sc_needwakeup |= CRYPTO_SYMQ;
 	}


More information about the svn-src-head mailing list