summaryrefslogtreecommitdiffstats
path: root/sys/netipsec/xform_ah.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-03-23 23:26:34 +0000
committerpjd <pjd@FreeBSD.org>2006-03-23 23:26:34 +0000
commit7d617251ccf3bd1070412da64297d4297326750f (patch)
treec1bc7035e9d14907aec090c8b90c47ea48fcb3f8 /sys/netipsec/xform_ah.c
parentca9322eb004cb4c274348373abcea11f597d4347 (diff)
downloadFreeBSD-src-7d617251ccf3bd1070412da64297d4297326750f.zip
FreeBSD-src-7d617251ccf3bd1070412da64297d4297326750f.tar.gz
Allow to use fast_ipsec(4) on debug.mpsafenet=0 and INVARIANTS-enabled
systems. Without the change it will panic on assertions. MFC after: 2 weeks
Diffstat (limited to 'sys/netipsec/xform_ah.c')
-rw-r--r--sys/netipsec/xform_ah.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/netipsec/xform_ah.c b/sys/netipsec/xform_ah.c
index 3b1f665..862134f 100644
--- a/sys/netipsec/xform_ah.c
+++ b/sys/netipsec/xform_ah.c
@@ -734,6 +734,8 @@ ah_input_cb(struct cryptop *crp)
caddr_t ptr;
int authsize;
+ NET_LOCK_GIANT();
+
crd = crp->crp_desc;
tc = (struct tdb_crypto *) crp->crp_opaque;
@@ -764,8 +766,11 @@ ah_input_cb(struct cryptop *crp)
if (sav->tdb_cryptoid != 0)
sav->tdb_cryptoid = crp->crp_sid;
- if (crp->crp_etype == EAGAIN)
- return crypto_dispatch(crp);
+ if (crp->crp_etype == EAGAIN) {
+ error = crypto_dispatch(crp);
+ NET_UNLOCK_GIANT();
+ return error;
+ }
ahstat.ahs_noxform++;
DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype));
@@ -857,7 +862,7 @@ ah_input_cb(struct cryptop *crp)
IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, mtag);
KEY_FREESAV(&sav);
-
+ NET_UNLOCK_GIANT();
return error;
bad:
if (sav)
@@ -868,6 +873,7 @@ bad:
free(tc, M_XDATA);
if (crp != NULL)
crypto_freereq(crp);
+ NET_UNLOCK_GIANT();
return error;
}
@@ -1114,6 +1120,8 @@ ah_output_cb(struct cryptop *crp)
caddr_t ptr;
int err;
+ NET_LOCK_GIANT();
+
tc = (struct tdb_crypto *) crp->crp_opaque;
IPSEC_ASSERT(tc != NULL, ("null opaque data area!"));
skip = tc->tc_skip;
@@ -1140,7 +1148,9 @@ ah_output_cb(struct cryptop *crp)
if (crp->crp_etype == EAGAIN) {
KEY_FREESAV(&sav);
IPSECREQUEST_UNLOCK(isr);
- return crypto_dispatch(crp);
+ error = crypto_dispatch(crp);
+ NET_UNLOCK_GIANT();
+ return error;
}
ahstat.ahs_noxform++;
@@ -1172,7 +1182,7 @@ ah_output_cb(struct cryptop *crp)
err = ipsec_process_done(m, isr);
KEY_FREESAV(&sav);
IPSECREQUEST_UNLOCK(isr);
-
+ NET_UNLOCK_GIANT();
return err;
bad:
if (sav)
@@ -1182,6 +1192,7 @@ bad:
m_freem(m);
free(tc, M_XDATA);
crypto_freereq(crp);
+ NET_UNLOCK_GIANT();
return error;
}
OpenPOWER on IntegriCloud