mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-08 14:54:23 +08:00
tcp: fix possible sk_priority leak in tcp_v4_send_reset()
[ Upstream commit1e306ec49a
] When tcp_v4_send_reset() is called with @sk == NULL, we do not change ctl_sk->sk_priority, which could have been set from a prior invocation. Change tcp_v4_send_reset() to set sk_priority and sk_mark fields before calling ip_send_unicast_reply(). This means tcp_v4_send_reset() and tcp_v4_send_ack() no longer have to clear ctl_sk->sk_mark after their call to ip_send_unicast_reply(). Fixes:f6c0f5d209
("tcp: honor SO_PRIORITY in TIME_WAIT state") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Antoine Tenart <atenart@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2832d62446
commit
15251e783a
@ -820,6 +820,9 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb)
|
||||
inet_twsk(sk)->tw_priority : sk->sk_priority;
|
||||
transmit_time = tcp_transmit_time(sk);
|
||||
xfrm_sk_clone_policy(ctl_sk, sk);
|
||||
} else {
|
||||
ctl_sk->sk_mark = 0;
|
||||
ctl_sk->sk_priority = 0;
|
||||
}
|
||||
ip_send_unicast_reply(ctl_sk,
|
||||
skb, &TCP_SKB_CB(skb)->header.h4.opt,
|
||||
@ -827,7 +830,6 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb)
|
||||
&arg, arg.iov[0].iov_len,
|
||||
transmit_time);
|
||||
|
||||
ctl_sk->sk_mark = 0;
|
||||
xfrm_sk_free_policy(ctl_sk);
|
||||
sock_net_set(ctl_sk, &init_net);
|
||||
__TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
|
||||
@ -926,7 +928,6 @@ static void tcp_v4_send_ack(const struct sock *sk,
|
||||
&arg, arg.iov[0].iov_len,
|
||||
transmit_time);
|
||||
|
||||
ctl_sk->sk_mark = 0;
|
||||
sock_net_set(ctl_sk, &init_net);
|
||||
__TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
|
||||
local_bh_enable();
|
||||
|
Loading…
Reference in New Issue
Block a user