@@ -918,6 +918,8 @@ static void tcp_v4_send_ack(const struct sock *sk,
rep.th.window = htons(win);
#ifdef CONFIG_TCP_MD5SIG
+ if (unlikely(!!key != !!tcp_parse_md5sig_option(th)))
+ return;
if (key) {
int offset = (tsecr) ? 3 : 0;
@@ -863,6 +863,8 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
if (tsecr)
tot_len += TCPOLEN_TSTAMP_ALIGNED;
#ifdef CONFIG_TCP_MD5SIG
+ if (!rst && unlikely(!!key != !!tcp_parse_md5sig_option(th)))
+ return;
if (key)
tot_len += TCPOLEN_MD5SIG_ALIGNED;
#endif
To mirror RST paranoid checks and tcp_inbound_md5_hash(). Signed-off-by: Dmitry Safonov <dima@arista.com> --- net/ipv4/tcp_ipv4.c | 2 ++ net/ipv6/tcp_ipv6.c | 2 ++ 2 files changed, 4 insertions(+)