diff options
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 8 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index d07f5ce31824..0a4260719a12 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -216,8 +216,8 @@ out: | |||
216 | 216 | ||
217 | expired: | 217 | expired: |
218 | read_unlock(&xp->lock); | 218 | read_unlock(&xp->lock); |
219 | km_policy_expired(xp, dir, 1); | 219 | if (!xfrm_policy_delete(xp, dir)) |
220 | xfrm_policy_delete(xp, dir); | 220 | km_policy_expired(xp, dir, 1); |
221 | xfrm_pol_put(xp); | 221 | xfrm_pol_put(xp); |
222 | } | 222 | } |
223 | 223 | ||
@@ -555,7 +555,7 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol, | |||
555 | return NULL; | 555 | return NULL; |
556 | } | 556 | } |
557 | 557 | ||
558 | void xfrm_policy_delete(struct xfrm_policy *pol, int dir) | 558 | int xfrm_policy_delete(struct xfrm_policy *pol, int dir) |
559 | { | 559 | { |
560 | write_lock_bh(&xfrm_policy_lock); | 560 | write_lock_bh(&xfrm_policy_lock); |
561 | pol = __xfrm_policy_unlink(pol, dir); | 561 | pol = __xfrm_policy_unlink(pol, dir); |
@@ -564,7 +564,9 @@ void xfrm_policy_delete(struct xfrm_policy *pol, int dir) | |||
564 | if (dir < XFRM_POLICY_MAX) | 564 | if (dir < XFRM_POLICY_MAX) |
565 | atomic_inc(&flow_cache_genid); | 565 | atomic_inc(&flow_cache_genid); |
566 | xfrm_policy_kill(pol); | 566 | xfrm_policy_kill(pol); |
567 | return 0; | ||
567 | } | 568 | } |
569 | return -ENOENT; | ||
568 | } | 570 | } |
569 | 571 | ||
570 | int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol) | 572 | int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol) |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 918a94c552a5..94f7416a4ab0 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -154,6 +154,7 @@ static void xfrm_timer_handler(unsigned long data) | |||
154 | next = tmo; | 154 | next = tmo; |
155 | } | 155 | } |
156 | 156 | ||
157 | x->km.dying = warn; | ||
157 | if (warn) | 158 | if (warn) |
158 | km_state_expired(x, 0); | 159 | km_state_expired(x, 0); |
159 | resched: | 160 | resched: |
@@ -169,9 +170,8 @@ expired: | |||
169 | next = 2; | 170 | next = 2; |
170 | goto resched; | 171 | goto resched; |
171 | } | 172 | } |
172 | if (x->id.spi != 0) | 173 | if (!__xfrm_state_delete(x) && x->id.spi) |
173 | km_state_expired(x, 1); | 174 | km_state_expired(x, 1); |
174 | __xfrm_state_delete(x); | ||
175 | 175 | ||
176 | out: | 176 | out: |
177 | spin_unlock(&x->lock); | 177 | spin_unlock(&x->lock); |
@@ -566,16 +566,18 @@ int xfrm_state_check_expire(struct xfrm_state *x) | |||
566 | 566 | ||
567 | if (x->curlft.bytes >= x->lft.hard_byte_limit || | 567 | if (x->curlft.bytes >= x->lft.hard_byte_limit || |
568 | x->curlft.packets >= x->lft.hard_packet_limit) { | 568 | x->curlft.packets >= x->lft.hard_packet_limit) { |
569 | km_state_expired(x, 1); | 569 | x->km.state = XFRM_STATE_EXPIRED; |
570 | if (!mod_timer(&x->timer, jiffies + XFRM_ACQ_EXPIRES*HZ)) | 570 | if (!mod_timer(&x->timer, jiffies)) |
571 | xfrm_state_hold(x); | 571 | xfrm_state_hold(x); |
572 | return -EINVAL; | 572 | return -EINVAL; |
573 | } | 573 | } |
574 | 574 | ||
575 | if (!x->km.dying && | 575 | if (!x->km.dying && |
576 | (x->curlft.bytes >= x->lft.soft_byte_limit || | 576 | (x->curlft.bytes >= x->lft.soft_byte_limit || |
577 | x->curlft.packets >= x->lft.soft_packet_limit)) | 577 | x->curlft.packets >= x->lft.soft_packet_limit)) { |
578 | x->km.dying = 1; | ||
578 | km_state_expired(x, 0); | 579 | km_state_expired(x, 0); |
580 | } | ||
579 | return 0; | 581 | return 0; |
580 | } | 582 | } |
581 | EXPORT_SYMBOL(xfrm_state_check_expire); | 583 | EXPORT_SYMBOL(xfrm_state_check_expire); |
@@ -833,10 +835,6 @@ static void km_state_expired(struct xfrm_state *x, int hard) | |||
833 | { | 835 | { |
834 | struct km_event c; | 836 | struct km_event c; |
835 | 837 | ||
836 | if (hard) | ||
837 | x->km.state = XFRM_STATE_EXPIRED; | ||
838 | else | ||
839 | x->km.dying = 1; | ||
840 | c.data = hard; | 838 | c.data = hard; |
841 | c.event = XFRM_SAP_EXPIRED; | 839 | c.event = XFRM_SAP_EXPIRED; |
842 | km_state_notify(x, &c); | 840 | km_state_notify(x, &c); |