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>
This commit is contained in:
committed by
David S. Miller
parent
30e80b55dd
commit
43264e0bd9
@@ -486,7 +486,6 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst,
|
|||||||
struct inet6_request_sock *treq = inet6_rsk(req);
|
struct inet6_request_sock *treq = inet6_rsk(req);
|
||||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||||
struct sk_buff * skb;
|
struct sk_buff * skb;
|
||||||
struct ipv6_txoptions *opt = np->opt;
|
|
||||||
int err = -ENOMEM;
|
int err = -ENOMEM;
|
||||||
|
|
||||||
/* First, grab a route. */
|
/* First, grab a route. */
|
||||||
@@ -500,13 +499,11 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst,
|
|||||||
|
|
||||||
fl6->daddr = treq->rmt_addr;
|
fl6->daddr = treq->rmt_addr;
|
||||||
skb_set_queue_mapping(skb, queue_mapping);
|
skb_set_queue_mapping(skb, queue_mapping);
|
||||||
err = ip6_xmit(sk, skb, fl6, opt, np->tclass);
|
err = ip6_xmit(sk, skb, fl6, np->opt, np->tclass);
|
||||||
err = net_xmit_eval(err);
|
err = net_xmit_eval(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (opt && opt != np->opt)
|
|
||||||
sock_kfree_s(sk, opt, opt->tot_len);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1229,7 +1226,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
|
|||||||
struct inet_sock *newinet;
|
struct inet_sock *newinet;
|
||||||
struct tcp_sock *newtp;
|
struct tcp_sock *newtp;
|
||||||
struct sock *newsk;
|
struct sock *newsk;
|
||||||
struct ipv6_txoptions *opt;
|
|
||||||
#ifdef CONFIG_TCP_MD5SIG
|
#ifdef CONFIG_TCP_MD5SIG
|
||||||
struct tcp_md5sig_key *key;
|
struct tcp_md5sig_key *key;
|
||||||
#endif
|
#endif
|
||||||
@@ -1290,7 +1286,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
treq = inet6_rsk(req);
|
treq = inet6_rsk(req);
|
||||||
opt = np->opt;
|
|
||||||
|
|
||||||
if (sk_acceptq_is_full(sk))
|
if (sk_acceptq_is_full(sk))
|
||||||
goto out_overflow;
|
goto out_overflow;
|
||||||
@@ -1359,11 +1354,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
|
|||||||
but we make one more one thing there: reattach optmem
|
but we make one more one thing there: reattach optmem
|
||||||
to newsk.
|
to newsk.
|
||||||
*/
|
*/
|
||||||
if (opt) {
|
if (np->opt)
|
||||||
newnp->opt = ipv6_dup_options(newsk, opt);
|
newnp->opt = ipv6_dup_options(newsk, np->opt);
|
||||||
if (opt != np->opt)
|
|
||||||
sock_kfree_s(sk, opt, opt->tot_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
inet_csk(newsk)->icsk_ext_hdr_len = 0;
|
inet_csk(newsk)->icsk_ext_hdr_len = 0;
|
||||||
if (newnp->opt)
|
if (newnp->opt)
|
||||||
@@ -1410,8 +1402,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
|
|||||||
out_overflow:
|
out_overflow:
|
||||||
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS);
|
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS);
|
||||||
out_nonewsk:
|
out_nonewsk:
|
||||||
if (opt && opt != np->opt)
|
|
||||||
sock_kfree_s(sk, opt, opt->tot_len);
|
|
||||||
dst_release(dst);
|
dst_release(dst);
|
||||||
out:
|
out:
|
||||||
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
|
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
|
||||||
|
Reference in New Issue
Block a user