diff options
Diffstat (limited to 'net/xfrm/xfrm_policy.c')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 8 |
1 files changed, 5 insertions, 3 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) |