diff options
author | RongQing.Li <roy.qing.li@gmail.com> | 2012-07-01 13:18:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-05 06:11:15 -0400 |
commit | 43264e0bd96304092062c013b0612cc944508288 (patch) | |
tree | 49f253e1ca2afa4829f19bad3e9eaf05e412c97a | |
parent | 30e80b55dd250b17c2570e234d2be34a0718063e (diff) |
ipv6: remove unnecessary codes in tcp_ipv6.c
opt always equals np->opts, so it is meaningless to define opt, and
check if opt does not equal np->opts and then try to free opt.
Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 9c06eafaf695..6cc67ed6c2e6 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -486,7 +486,6 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst, | |||
486 | struct inet6_request_sock *treq = inet6_rsk(req); | 486 | struct inet6_request_sock *treq = inet6_rsk(req); |
487 | struct ipv6_pinfo *np = inet6_sk(sk); | 487 | struct ipv6_pinfo *np = inet6_sk(sk); |
488 | struct sk_buff * skb; | 488 | struct sk_buff * skb; |
489 | struct ipv6_txoptions *opt = np->opt; | ||
490 | int err = -ENOMEM; | 489 | int err = -ENOMEM; |
491 | 490 | ||
492 | /* First, grab a route. */ | 491 | /* First, grab a route. */ |
@@ -500,13 +499,11 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst, | |||
500 | 499 | ||
501 | fl6->daddr = treq->rmt_addr; | 500 | fl6->daddr = treq->rmt_addr; |
502 | skb_set_queue_mapping(skb, queue_mapping); | 501 | skb_set_queue_mapping(skb, queue_mapping); |
503 | err = ip6_xmit(sk, skb, fl6, opt, np->tclass); | 502 | err = ip6_xmit(sk, skb, fl6, np->opt, np->tclass); |
504 | err = net_xmit_eval(err); | 503 | err = net_xmit_eval(err); |
505 | } | 504 | } |
506 | 505 | ||
507 | done: | 506 | done: |
508 | if (opt && opt != np->opt) | ||
509 | sock_kfree_s(sk, opt, opt->tot_len); | ||
510 | return err; | 507 | return err; |
511 | } | 508 | } |
512 | 509 | ||
@@ -1229,7 +1226,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1229 | struct inet_sock *newinet; | 1226 | struct inet_sock *newinet; |
1230 | struct tcp_sock *newtp; | 1227 | struct tcp_sock *newtp; |
1231 | struct sock *newsk; | 1228 | struct sock *newsk; |
1232 | struct ipv6_txoptions *opt; | ||
1233 | #ifdef CONFIG_TCP_MD5SIG | 1229 | #ifdef CONFIG_TCP_MD5SIG |
1234 | struct tcp_md5sig_key *key; | 1230 | struct tcp_md5sig_key *key; |
1235 | #endif | 1231 | #endif |
@@ -1290,7 +1286,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1290 | } | 1286 | } |
1291 | 1287 | ||
1292 | treq = inet6_rsk(req); | 1288 | treq = inet6_rsk(req); |
1293 | opt = np->opt; | ||
1294 | 1289 | ||
1295 | if (sk_acceptq_is_full(sk)) | 1290 | if (sk_acceptq_is_full(sk)) |
1296 | goto out_overflow; | 1291 | goto out_overflow; |
@@ -1359,11 +1354,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1359 | but we make one more one thing there: reattach optmem | 1354 | but we make one more one thing there: reattach optmem |
1360 | to newsk. | 1355 | to newsk. |
1361 | */ | 1356 | */ |
1362 | if (opt) { | 1357 | if (np->opt) |
1363 | newnp->opt = ipv6_dup_options(newsk, opt); | 1358 | newnp->opt = ipv6_dup_options(newsk, np->opt); |
1364 | if (opt != np->opt) | ||
1365 | sock_kfree_s(sk, opt, opt->tot_len); | ||
1366 | } | ||
1367 | 1359 | ||
1368 | inet_csk(newsk)->icsk_ext_hdr_len = 0; | 1360 | inet_csk(newsk)->icsk_ext_hdr_len = 0; |
1369 | if (newnp->opt) | 1361 | if (newnp->opt) |
@@ -1410,8 +1402,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1410 | out_overflow: | 1402 | out_overflow: |
1411 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); | 1403 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); |
1412 | out_nonewsk: | 1404 | out_nonewsk: |
1413 | if (opt && opt != np->opt) | ||
1414 | sock_kfree_s(sk, opt, opt->tot_len); | ||
1415 | dst_release(dst); | 1405 | dst_release(dst); |
1416 | out: | 1406 | out: |
1417 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); | 1407 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); |