Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec Call key_sendup_mbuf immediately unless key_acq...



details:   https://anonhg.NetBSD.org/src/rev/f772edad5829
branches:  trunk
changeset: 357681:f772edad5829
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Nov 21 07:33:06 2017 +0000

description:
Call key_sendup_mbuf immediately unless key_acquire is called in softint

We need to defer it only if it's called in softint to avoid deadlock.

diffstat:

 sys/netipsec/key.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r fe4f1d24e4d4 -r f772edad5829 sys/netipsec/key.c
--- a/sys/netipsec/key.c        Tue Nov 21 07:25:17 2017 +0000
+++ b/sys/netipsec/key.c        Tue Nov 21 07:33:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: key.c,v 1.241 2017/11/21 07:25:17 ozaki-r Exp $        */
+/*     $NetBSD: key.c,v 1.242 2017/11/21 07:33:06 ozaki-r Exp $        */
 /*     $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $        */
 /*     $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $   */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.241 2017/11/21 07:25:17 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.242 2017/11/21 07:33:06 ozaki-r Exp $");
 
 /*
  * This code is referred to RFC 2367
@@ -6570,6 +6570,12 @@
            PFKEY_UNIT64(result->m_pkthdr.len);
 
        /*
+        * Called from key_api_acquire that must come from userland, so
+        * we can call key_sendup_mbuf immediately.
+        */
+       if (mflag == M_WAITOK)
+               return key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED);
+       /*
         * XXX we cannot call key_sendup_mbuf directly here because
         * it can cause a deadlock:
         * - We have a reference to an SP (and an SA) here



Home | Main Index | Thread Index | Old Index