aboutsummaryrefslogtreecommitdiff
path: root/sys/netipsec/key.c
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2010-03-28 06:51:50 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2010-03-28 06:51:50 +0000
commit8b7893b056cf070eb88621171640f3930cdd5c4f (patch)
tree64a811fa14e90b43d84b8b1cb840c407273800bb /sys/netipsec/key.c
parent3905e2089818d977626dfaa82cce249b33c24b75 (diff)
downloadsrc-8b7893b056cf070eb88621171640f3930cdd5c4f.tar.gz
src-8b7893b056cf070eb88621171640f3930cdd5c4f.zip
When tearing down IPsec as part of a (virtual) network stack,
do not try to free the same list twice but free both the acquiring list and the security policy acquiring list. Reviewed by: anchie MFC after: 3 days
Notes
Notes: svn path=/head/; revision=205789
Diffstat (limited to 'sys/netipsec/key.c')
-rw-r--r--sys/netipsec/key.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index c5aa4b78ba8f..e3a61aced00d 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -7779,7 +7779,8 @@ void
key_destroy(void)
{
struct secpolicy *sp, *nextsp;
- struct secspacq *acq, *nextacq;
+ struct secacq *acq, *nextacq;
+ struct secspacq *spacq, *nextspacq;
struct secashead *sah, *nextsah;
struct secreg *reg;
int i;
@@ -7820,7 +7821,7 @@ key_destroy(void)
REGTREE_UNLOCK();
ACQ_LOCK();
- for (acq = LIST_FIRST(&V_spacqtree); acq != NULL; acq = nextacq) {
+ for (acq = LIST_FIRST(&V_acqtree); acq != NULL; acq = nextacq) {
nextacq = LIST_NEXT(acq, chain);
if (__LIST_CHAINED(acq)) {
LIST_REMOVE(acq, chain);
@@ -7830,11 +7831,12 @@ key_destroy(void)
ACQ_UNLOCK();
SPACQ_LOCK();
- for (acq = LIST_FIRST(&V_spacqtree); acq != NULL; acq = nextacq) {
- nextacq = LIST_NEXT(acq, chain);
- if (__LIST_CHAINED(acq)) {
- LIST_REMOVE(acq, chain);
- free(acq, M_IPSEC_SAQ);
+ for (spacq = LIST_FIRST(&V_spacqtree); spacq != NULL;
+ spacq = nextspacq) {
+ nextspacq = LIST_NEXT(spacq, chain);
+ if (__LIST_CHAINED(spacq)) {
+ LIST_REMOVE(spacq, chain);
+ free(spacq, M_IPSEC_SAQ);
}
}
SPACQ_UNLOCK();