diff options
author | RongQing.Li <roy.qing.li@gmail.com> | 2012-07-01 13:19:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-05 06:11:15 -0400 |
commit | 0979e465c5ab205b63a1c1820fe833f396a120f0 (patch) | |
tree | 36bd508fb6b68000d1a78c675494a58a6885c84e /net/dccp/ipv6.c | |
parent | 43264e0bd96304092062c013b0612cc944508288 (diff) |
dccp: remove unnecessary codes in 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>
Diffstat (limited to 'net/dccp/ipv6.c')
-rw-r--r-- | net/dccp/ipv6.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 9991be083ad0..02162cfa5048 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -239,7 +239,6 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
239 | struct inet6_request_sock *ireq6 = inet6_rsk(req); | 239 | struct inet6_request_sock *ireq6 = inet6_rsk(req); |
240 | struct ipv6_pinfo *np = inet6_sk(sk); | 240 | struct ipv6_pinfo *np = inet6_sk(sk); |
241 | struct sk_buff *skb; | 241 | struct sk_buff *skb; |
242 | struct ipv6_txoptions *opt = NULL; | ||
243 | struct in6_addr *final_p, final; | 242 | struct in6_addr *final_p, final; |
244 | struct flowi6 fl6; | 243 | struct flowi6 fl6; |
245 | int err = -1; | 244 | int err = -1; |
@@ -255,9 +254,8 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
255 | fl6.fl6_sport = inet_rsk(req)->loc_port; | 254 | fl6.fl6_sport = inet_rsk(req)->loc_port; |
256 | security_req_classify_flow(req, flowi6_to_flowi(&fl6)); | 255 | security_req_classify_flow(req, flowi6_to_flowi(&fl6)); |
257 | 256 | ||
258 | opt = np->opt; | ||
259 | 257 | ||
260 | final_p = fl6_update_dst(&fl6, opt, &final); | 258 | final_p = fl6_update_dst(&fl6, np->opt, &final); |
261 | 259 | ||
262 | dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); | 260 | dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); |
263 | if (IS_ERR(dst)) { | 261 | if (IS_ERR(dst)) { |
@@ -274,13 +272,11 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
274 | &ireq6->loc_addr, | 272 | &ireq6->loc_addr, |
275 | &ireq6->rmt_addr); | 273 | &ireq6->rmt_addr); |
276 | fl6.daddr = ireq6->rmt_addr; | 274 | fl6.daddr = ireq6->rmt_addr; |
277 | err = ip6_xmit(sk, skb, &fl6, opt, np->tclass); | 275 | err = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass); |
278 | err = net_xmit_eval(err); | 276 | err = net_xmit_eval(err); |
279 | } | 277 | } |
280 | 278 | ||
281 | done: | 279 | done: |
282 | if (opt != NULL && opt != np->opt) | ||
283 | sock_kfree_s(sk, opt, opt->tot_len); | ||
284 | dst_release(dst); | 280 | dst_release(dst); |
285 | return err; | 281 | return err; |
286 | } | 282 | } |
@@ -475,7 +471,6 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
475 | struct inet_sock *newinet; | 471 | struct inet_sock *newinet; |
476 | struct dccp6_sock *newdp6; | 472 | struct dccp6_sock *newdp6; |
477 | struct sock *newsk; | 473 | struct sock *newsk; |
478 | struct ipv6_txoptions *opt; | ||
479 | 474 | ||
480 | if (skb->protocol == htons(ETH_P_IP)) { | 475 | if (skb->protocol == htons(ETH_P_IP)) { |
481 | /* | 476 | /* |
@@ -520,7 +515,6 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
520 | return newsk; | 515 | return newsk; |
521 | } | 516 | } |
522 | 517 | ||
523 | opt = np->opt; | ||
524 | 518 | ||
525 | if (sk_acceptq_is_full(sk)) | 519 | if (sk_acceptq_is_full(sk)) |
526 | goto out_overflow; | 520 | goto out_overflow; |
@@ -532,7 +526,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
532 | memset(&fl6, 0, sizeof(fl6)); | 526 | memset(&fl6, 0, sizeof(fl6)); |
533 | fl6.flowi6_proto = IPPROTO_DCCP; | 527 | fl6.flowi6_proto = IPPROTO_DCCP; |
534 | fl6.daddr = ireq6->rmt_addr; | 528 | fl6.daddr = ireq6->rmt_addr; |
535 | final_p = fl6_update_dst(&fl6, opt, &final); | 529 | final_p = fl6_update_dst(&fl6, np->opt, &final); |
536 | fl6.saddr = ireq6->loc_addr; | 530 | fl6.saddr = ireq6->loc_addr; |
537 | fl6.flowi6_oif = sk->sk_bound_dev_if; | 531 | fl6.flowi6_oif = sk->sk_bound_dev_if; |
538 | fl6.fl6_dport = inet_rsk(req)->rmt_port; | 532 | fl6.fl6_dport = inet_rsk(req)->rmt_port; |
@@ -597,11 +591,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
597 | * Yes, keeping reference count would be much more clever, but we make | 591 | * Yes, keeping reference count would be much more clever, but we make |
598 | * one more one thing there: reattach optmem to newsk. | 592 | * one more one thing there: reattach optmem to newsk. |
599 | */ | 593 | */ |
600 | if (opt != NULL) { | 594 | if (np->opt != NULL) |
601 | newnp->opt = ipv6_dup_options(newsk, opt); | 595 | newnp->opt = ipv6_dup_options(newsk, np->opt); |
602 | if (opt != np->opt) | ||
603 | sock_kfree_s(sk, opt, opt->tot_len); | ||
604 | } | ||
605 | 596 | ||
606 | inet_csk(newsk)->icsk_ext_hdr_len = 0; | 597 | inet_csk(newsk)->icsk_ext_hdr_len = 0; |
607 | if (newnp->opt != NULL) | 598 | if (newnp->opt != NULL) |
@@ -627,8 +618,6 @@ out_nonewsk: | |||
627 | dst_release(dst); | 618 | dst_release(dst); |
628 | out: | 619 | out: |
629 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); | 620 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); |
630 | if (opt != NULL && opt != np->opt) | ||
631 | sock_kfree_s(sk, opt, opt->tot_len); | ||
632 | return NULL; | 621 | return NULL; |
633 | } | 622 | } |
634 | 623 | ||