summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvanhu <vanhu@FreeBSD.org>2009-03-18 14:01:41 +0000
committervanhu <vanhu@FreeBSD.org>2009-03-18 14:01:41 +0000
commite33d6fbff66f2eccce1a11a22272916f2ec6ae54 (patch)
tree8e9d32d5ee2e9865497fbc44d00a2e3161ea7a8b
parent9823dc1697d9f71cb060552b28926f38caf0100e (diff)
downloadFreeBSD-src-e33d6fbff66f2eccce1a11a22272916f2ec6ae54.zip
FreeBSD-src-e33d6fbff66f2eccce1a11a22272916f2ec6ae54.tar.gz
Fixed deletion of sav entries in key_delsah()
Approved by: gnn(mentor) Obtained from: NETASQ MFC after: 1 month
-rw-r--r--sys/netipsec/key.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index 74d31dd..7956a8d 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -2687,7 +2687,10 @@ key_delsah(sah)
if (sav->refcnt == 0) {
/* sanity check */
KEY_CHKSASTATE(state, sav->state, __func__);
- KEY_FREESAV(&sav);
+ /* do NOT call KEY_FREESAV here: it will only delete the sav if refcnt == 1,
+ * where we already know that refcnt == 0
+ */
+ key_delsav(sav);
} else {
/* give up to delete this sa */
zombie++;
@@ -4131,6 +4134,8 @@ key_flush_sad(time_t now)
/* if LARVAL entry doesn't become MATURE, delete it. */
LIST_FOREACH_SAFE(sav, &sah->savtree[SADB_SASTATE_LARVAL], chain, nextsav) {
+ /* Need to also check refcnt for a larval SA ???
+ */
if (now - sav->created > V_key_larval_lifetime)
KEY_FREESAV(&sav);
}
OpenPOWER on IntegriCloud