Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/opencrypto apply the same fix as crypto.c:r1.83 for cryp...



details:   https://anonhg.NetBSD.org/src/rev/400a859f0f99
branches:  trunk
changeset: 824468:400a859f0f99
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Tue Jun 06 04:11:41 2017 +0000

description:
apply the same fix as crypto.c:r1.83 for crypto_dispatch to crypto_kdispatch.

diffstat:

 sys/opencrypto/crypto.c |  10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (56 lines):

diff -r 35c0b0fb8123 -r 400a859f0f99 sys/opencrypto/crypto.c
--- a/sys/opencrypto/crypto.c   Tue Jun 06 01:51:39 2017 +0000
+++ b/sys/opencrypto/crypto.c   Tue Jun 06 04:11:41 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crypto.c,v 1.83 2017/06/06 01:51:39 knakahara Exp $ */
+/*     $NetBSD: crypto.c,v 1.84 2017/06/06 04:11:41 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.83 2017/06/06 01:51:39 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.84 2017/06/06 04:11:41 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/reboot.h>
@@ -1097,6 +1097,7 @@
 
        cryptostats.cs_kops++;
 
+       mutex_enter(&crypto_q_mtx);
        cap = crypto_checkdriver_lock(krp->krp_hid);
        /*
         * TODO:
@@ -1104,10 +1105,8 @@
         * done crypto_unregister(), this migrate operation is not required.
         */
        if (cap == NULL) {
-               mutex_enter(&crypto_q_mtx);
                TAILQ_INSERT_TAIL(&crp_kq, krp, krp_next);
                mutex_exit(&crypto_q_mtx);
-
                return 0;
        }
 
@@ -1117,10 +1116,8 @@
                 * The driver is blocked, just queue the op until
                 * it unblocks and the swi thread gets kicked.
                 */
-               mutex_enter(&crypto_q_mtx);
                TAILQ_INSERT_TAIL(&crp_kq, krp, krp_next);
                mutex_exit(&crypto_q_mtx);
-
                return 0;
        }
 
@@ -1135,7 +1132,6 @@
                crypto_driver_lock(cap);
                cap->cc_kqblocked = 1;
                crypto_driver_unlock(cap);
-               mutex_enter(&crypto_q_mtx);
                TAILQ_INSERT_HEAD(&crp_kq, krp, krp_next);
                cryptostats.cs_kblocks++;
                mutex_exit(&crypto_q_mtx);



Home | Main Index | Thread Index | Old Index