tcp: fix possible sk_priority leak in tcp_v4_send_reset()
authorEric Dumazet <edumazet@google.com>
Thu, 11 May 2023 11:47:49 +0000 (11:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:44 +0000 (17:32 +0100)
commit820a60a4160f6f1479e6a5258ad0209351d3f5fe
tree355af6b7de15cdb52517345bdc48c2d9a63907b2
parent9bcf4794f1c633ff2e3d060b1d6c253cb51165d9
tcp: fix possible sk_priority leak in tcp_v4_send_reset()

[ Upstream commit 1e306ec49a1f206fd2cc89a42fac6e6f592a8cc1 ]

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: f6c0f5d209fa ("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>
net/ipv4/tcp_ipv4.c