summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2014-02-26 14:09:16 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2014-02-26 14:09:16 +0000
commit6d2d4998bb91781a29ad9121c47454f030c45da6 (patch)
tree2c6b7b12a65caf16687e8394d45342a0b4869035 /sbin
parent7b9270ae48cf7b650a8879fe0d11d7800bce7c37 (diff)
don't policy_ref an activate policy (policy_ref/unref are assymetrical),
otherwise the policy list might get corrupted; from haesbaert
Diffstat (limited to 'sbin')
-rw-r--r--sbin/iked/ikev2.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sbin/iked/ikev2.c b/sbin/iked/ikev2.c
index e534a2e7cee..025ab89b1f3 100644
--- a/sbin/iked/ikev2.c
+++ b/sbin/iked/ikev2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikev2.c,v 1.96 2014/02/21 20:52:38 markus Exp $ */
+/* $OpenBSD: ikev2.c,v 1.97 2014/02/26 14:09:15 markus Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -510,12 +510,9 @@ ikev2_ike_auth(struct iked *env, struct iked_sa *sa,
log_debug("%s: conflicting sa", __func__);
RB_INSERT(iked_sapeers, &old->pol_sapeers, sa);
msg->msg_policy = old;
- }
- policy = sa->sa_policy = msg->msg_policy;
- if (policy != old) {
+ } else
policy_unref(env, old);
- policy_ref(env, policy);
- }
+ policy = sa->sa_policy = msg->msg_policy;
} else {
/* restore */
msg->msg_policy = sa->sa_policy = old;