summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorangelos <angelos@openbsd.org>2002-07-05 23:20:53 +0000
committerangelos <angelos@openbsd.org>2002-07-05 23:20:53 +0000
commite53dc863918b0ce53dada9fd29b0126b6c82bc60 (patch)
tree410bad7303c9586223b0987f7a18d788d77ad624
parentAlso, return EAFNOSUPPORT instead of ENOBUFS. Both this and the (diff)
downloadwireguard-openbsd-e53dc863918b0ce53dada9fd29b0126b6c82bc60.tar.xz
wireguard-openbsd-e53dc863918b0ce53dada9fd29b0126b6c82bc60.zip
Free crp_opaque only after we've determined we're not going to
re-submit it. From sam@errno.com
-rw-r--r--sys/netinet/ip_ah.c5
-rw-r--r--sys/netinet/ip_esp.c8
-rw-r--r--sys/netinet/ip_ipcomp.c9
3 files changed, 13 insertions, 9 deletions
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c
index 64df8f8efc3..dd34a5c4ad8 100644
--- a/sys/netinet/ip_ah.c
+++ b/sys/netinet/ip_ah.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah.c,v 1.69 2002/06/26 00:13:47 angelos Exp $ */
+/* $OpenBSD: ip_ah.c,v 1.70 2002/07/05 23:20:53 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -1241,8 +1241,6 @@ ah_output_cb(void *op)
/* Check for crypto errors. */
if (crp->crp_etype) {
- FREE(tc, M_XDATA);
-
if (tdb->tdb_cryptoid != 0)
tdb->tdb_cryptoid = crp->crp_sid;
@@ -1251,6 +1249,7 @@ ah_output_cb(void *op)
return crypto_dispatch(crp);
}
+ FREE(tc, M_XDATA);
ahstat.ahs_noxform++;
DPRINTF(("ah_output_cb(): crypto error %d\n", crp->crp_etype));
error = crp->crp_etype;
diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c
index 9c5a2c57f08..4a3e0797e95 100644
--- a/sys/netinet/ip_esp.c
+++ b/sys/netinet/ip_esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp.c,v 1.73 2002/06/18 23:03:26 angelos Exp $ */
+/* $OpenBSD: ip_esp.c,v 1.74 2002/07/05 23:20:53 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -980,8 +980,8 @@ esp_output_cb(void *op)
s = spltdb();
tdb = gettdb(tc->tc_spi, &tc->tc_dst, tc->tc_proto);
- FREE(tc, M_XDATA);
if (tdb == NULL) {
+ FREE(tc, M_XDATA);
espstat.esps_notdb++;
DPRINTF(("esp_output_cb(): TDB is expired while in crypto\n"));
goto baddone;
@@ -998,12 +998,14 @@ esp_output_cb(void *op)
return crypto_dispatch(crp);
}
+ FREE(tc, M_XDATA);
espstat.esps_noxform++;
DPRINTF(("esp_output_cb(): crypto error %d\n",
crp->crp_etype));
error = crp->crp_etype;
goto baddone;
- }
+ } else
+ FREE(tc, M_XDATA);
/* Shouldn't happen... */
if (m == NULL) {
diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c
index 3bf83307f99..f731de33150 100644
--- a/sys/netinet/ip_ipcomp.c
+++ b/sys/netinet/ip_ipcomp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipcomp.c,v 1.7 2002/06/20 03:49:02 deraadt Exp $ */
+/* $OpenBSD: ip_ipcomp.c,v 1.8 2002/07/05 23:20:53 angelos Exp $ */
/*
* Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
@@ -626,8 +626,8 @@ ipcomp_output_cb(cp)
s = spltdb();
tdb = gettdb(tc->tc_spi, &tc->tc_dst, tc->tc_proto);
- FREE(tc, M_XDATA);
if (tdb == NULL) {
+ FREE(tc, M_XDATA);
ipcompstat.ipcomps_notdb++;
DPRINTF(("ipcomp_output_cb(): TDB expired while in crypto\n"));
goto baddone;
@@ -644,11 +644,14 @@ ipcomp_output_cb(cp)
return crypto_dispatch(crp);
}
+ FREE(tc, M_XDATA);
ipcompstat.ipcomps_noxform++;
DPRINTF(("ipcomp_output_cb(): crypto error %d\n",
crp->crp_etype));
goto baddone;
- }
+ } else
+ FREE(tc, M_XDATA);
+
/* Shouldn't happen... */
if (m == NULL) {
ipcompstat.ipcomps_crypto++;