tcp: md5: incorrect tcp_header_len for incoming connections
authorFrancesco Ruggeri <fruggeri@arista.com>
Thu, 21 Apr 2022 00:50:26 +0000 (17:50 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 07:14:35 +0000 (09:14 +0200)
commiteb90a4269c20d41c840c170f47278ab634c2400f
treed9f5ed9814543725e29f1ce125cd0b794873472d
parenteea166561f7c70128263637cf99b1576b4bd1be4
tcp: md5: incorrect tcp_header_len for incoming connections

[ Upstream commit 5b0b9e4c2c895227c8852488b3f09839233bba54 ]

In tcp_create_openreq_child we adjust tcp_header_len for md5 using the
remote address in newsk. But that address is still 0 in newsk at this
point, and it is only set later by the callers (tcp_v[46]_syn_recv_sock).
Use the address from the request socket instead.

Fixes: cfb6eeb4c860 ("[TCP]: MD5 Signature Option (RFC2385) support.")
Signed-off-by: Francesco Ruggeri <fruggeri@arista.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20220421005026.686A45EC01F2@us226.sjc.aristanetworks.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/tcp_minisocks.c