Commit 43264e0bd96304092062c013b0612cc944508288
Committed by
David S. Miller
1 parent
30e80b55dd
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 3 additions and 13 deletions Side-by-side Diff
net/ipv6/tcp_ipv6.c
... | ... | @@ -486,7 +486,6 @@ |
486 | 486 | struct inet6_request_sock *treq = inet6_rsk(req); |
487 | 487 | struct ipv6_pinfo *np = inet6_sk(sk); |
488 | 488 | struct sk_buff * skb; |
489 | - struct ipv6_txoptions *opt = np->opt; | |
490 | 489 | int err = -ENOMEM; |
491 | 490 | |
492 | 491 | /* First, grab a route. */ |
493 | 492 | |
... | ... | @@ -500,13 +499,11 @@ |
500 | 499 | |
501 | 500 | fl6->daddr = treq->rmt_addr; |
502 | 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 | 503 | err = net_xmit_eval(err); |
505 | 504 | } |
506 | 505 | |
507 | 506 | done: |
508 | - if (opt && opt != np->opt) | |
509 | - sock_kfree_s(sk, opt, opt->tot_len); | |
510 | 507 | return err; |
511 | 508 | } |
512 | 509 | |
... | ... | @@ -1229,7 +1226,6 @@ |
1229 | 1226 | struct inet_sock *newinet; |
1230 | 1227 | struct tcp_sock *newtp; |
1231 | 1228 | struct sock *newsk; |
1232 | - struct ipv6_txoptions *opt; | |
1233 | 1229 | #ifdef CONFIG_TCP_MD5SIG |
1234 | 1230 | struct tcp_md5sig_key *key; |
1235 | 1231 | #endif |
... | ... | @@ -1290,7 +1286,6 @@ |
1290 | 1286 | } |
1291 | 1287 | |
1292 | 1288 | treq = inet6_rsk(req); |
1293 | - opt = np->opt; | |
1294 | 1289 | |
1295 | 1290 | if (sk_acceptq_is_full(sk)) |
1296 | 1291 | goto out_overflow; |
... | ... | @@ -1359,11 +1354,8 @@ |
1359 | 1354 | but we make one more one thing there: reattach optmem |
1360 | 1355 | to newsk. |
1361 | 1356 | */ |
1362 | - if (opt) { | |
1363 | - newnp->opt = ipv6_dup_options(newsk, opt); | |
1364 | - if (opt != np->opt) | |
1365 | - sock_kfree_s(sk, opt, opt->tot_len); | |
1366 | - } | |
1357 | + if (np->opt) | |
1358 | + newnp->opt = ipv6_dup_options(newsk, np->opt); | |
1367 | 1359 | |
1368 | 1360 | inet_csk(newsk)->icsk_ext_hdr_len = 0; |
1369 | 1361 | if (newnp->opt) |
... | ... | @@ -1410,8 +1402,6 @@ |
1410 | 1402 | out_overflow: |
1411 | 1403 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); |
1412 | 1404 | out_nonewsk: |
1413 | - if (opt && opt != np->opt) | |
1414 | - sock_kfree_s(sk, opt, opt->tot_len); | |
1415 | 1405 | dst_release(dst); |
1416 | 1406 | out: |
1417 | 1407 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); |