Module Name:    src
Committed By:   knakahara
Date:           Wed Apr 26 03:29:37 UTC 2017

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

Log Message:
When crypto request is deferred processing, opencrypto should not return error.

When the crypto device blocks a crypto request, opnecrypto enqueues the request,
that is, the request is just deferred and no error occurs.
The pseudo error causes problems, e.g. ipsec can send wrong ICMP host unreach.

contributed by hsuenaga@IIJ, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 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.57 src/sys/opencrypto/crypto.c:1.58
--- src/sys/opencrypto/crypto.c:1.57	Mon Apr 24 03:29:37 2017
+++ src/sys/opencrypto/crypto.c	Wed Apr 26 03:29:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.57 2017/04/24 03:29:37 knakahara Exp $ */
+/*	$NetBSD: crypto.c,v 1.58 2017/04/26 03:29:36 knakahara 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.57 2017/04/24 03:29:37 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.58 2017/04/26 03:29:36 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/reboot.h>
@@ -774,6 +774,13 @@ crypto_dispatch(struct cryptop *crp)
 				TAILQ_INSERT_HEAD(&crp_q, crp, crp_next);
 				cryptostats.cs_blocks++;
 				mutex_spin_exit(&crypto_q_mtx);
+
+				/*
+				 * The crp is enqueued to crp_q, that is,
+				 * no error occurs. So, this function should
+				 * not return error.
+				 */
+				result = 0;
 			}
 			goto out_released;
 		} else {
@@ -836,6 +843,13 @@ crypto_kdispatch(struct cryptkop *krp)
 			TAILQ_INSERT_HEAD(&crp_kq, krp, krp_next);
 			cryptostats.cs_kblocks++;
 			mutex_spin_exit(&crypto_q_mtx);
+
+			/*
+			 * The krp is enqueued to crp_kq, that is,
+			 * no error occurs. So, this function should
+			 * not return error.
+			 */
+			result = 0;
 		}
 	} else {
 		/*

Reply via email to