diff options
author | Patrick McHardy <kaber@trash.net> | 2005-09-08 18:11:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-09-08 18:11:55 -0400 |
commit | e104411b82f5c4d19752c335492036abdbf5880d (patch) | |
tree | 03f26f98685689ab6bfa47d5bdbb6730f64bfadb /net/ipv6/tcp_ipv6.c | |
parent | cf0b450cd5176b68ac7d5bbe68aeae6bb6a5a4b8 (diff) |
[XFRM]: Always release dst_entry on error in xfrm_lookup
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 246414b27d0e..80643e6b346b 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -632,10 +632,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
632 | if (final_p) | 632 | if (final_p) |
633 | ipv6_addr_copy(&fl.fl6_dst, final_p); | 633 | ipv6_addr_copy(&fl.fl6_dst, final_p); |
634 | 634 | ||
635 | if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) { | 635 | if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) |
636 | dst_release(dst); | ||
637 | goto failure; | 636 | goto failure; |
638 | } | ||
639 | 637 | ||
640 | if (saddr == NULL) { | 638 | if (saddr == NULL) { |
641 | saddr = &fl.fl6_src; | 639 | saddr = &fl.fl6_src; |
@@ -888,7 +886,6 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | |||
888 | } | 886 | } |
889 | 887 | ||
890 | done: | 888 | done: |
891 | dst_release(dst); | ||
892 | if (opt && opt != np->opt) | 889 | if (opt && opt != np->opt) |
893 | sock_kfree_s(sk, opt, opt->tot_len); | 890 | sock_kfree_s(sk, opt, opt->tot_len); |
894 | return err; | 891 | return err; |
@@ -1000,10 +997,8 @@ static void tcp_v6_send_reset(struct sk_buff *skb) | |||
1000 | /* sk = NULL, but it is safe for now. RST socket required. */ | 997 | /* sk = NULL, but it is safe for now. RST socket required. */ |
1001 | if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) { | 998 | if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) { |
1002 | 999 | ||
1003 | if ((xfrm_lookup(&buff->dst, &fl, NULL, 0)) < 0) { | 1000 | if ((xfrm_lookup(&buff->dst, &fl, NULL, 0)) < 0) |
1004 | dst_release(buff->dst); | ||
1005 | return; | 1001 | return; |
1006 | } | ||
1007 | 1002 | ||
1008 | ip6_xmit(NULL, buff, &fl, NULL, 0); | 1003 | ip6_xmit(NULL, buff, &fl, NULL, 0); |
1009 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); | 1004 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); |
@@ -1067,10 +1062,8 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32 | |||
1067 | fl.fl_ip_sport = t1->source; | 1062 | fl.fl_ip_sport = t1->source; |
1068 | 1063 | ||
1069 | if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) { | 1064 | if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) { |
1070 | if ((xfrm_lookup(&buff->dst, &fl, NULL, 0)) < 0) { | 1065 | if ((xfrm_lookup(&buff->dst, &fl, NULL, 0)) < 0) |
1071 | dst_release(buff->dst); | ||
1072 | return; | 1066 | return; |
1073 | } | ||
1074 | ip6_xmit(NULL, buff, &fl, NULL, 0); | 1067 | ip6_xmit(NULL, buff, &fl, NULL, 0); |
1075 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); | 1068 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); |
1076 | return; | 1069 | return; |
@@ -1733,7 +1726,6 @@ static int tcp_v6_rebuild_header(struct sock *sk) | |||
1733 | 1726 | ||
1734 | if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) { | 1727 | if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) { |
1735 | sk->sk_err_soft = -err; | 1728 | sk->sk_err_soft = -err; |
1736 | dst_release(dst); | ||
1737 | return err; | 1729 | return err; |
1738 | } | 1730 | } |
1739 | 1731 | ||
@@ -1786,7 +1778,6 @@ static int tcp_v6_xmit(struct sk_buff *skb, int ipfragok) | |||
1786 | 1778 | ||
1787 | if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) { | 1779 | if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) { |
1788 | sk->sk_route_caps = 0; | 1780 | sk->sk_route_caps = 0; |
1789 | dst_release(dst); | ||
1790 | return err; | 1781 | return err; |
1791 | } | 1782 | } |
1792 | 1783 | ||