FAILED: patch "[PATCH] net/tcp-md5: Fix MAC comparison to be constant-time" failed to apply to 6.1-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 46d0d6f50dab706637f4c18a470aac20a21900d3
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026031758-willfully-striving-06dd@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 46d0d6f50dab706637f4c18a470aac20a21900d3 Mon Sep 17 00:00:00 2001
From: Eric Biggers <[email protected]>
Date: Mon, 2 Mar 2026 12:34:09 -0800
Subject: [PATCH] net/tcp-md5: Fix MAC comparison to be constant-time
To prevent timing attacks, MACs need to be compared in constant time. Use the appropriate helper function for this.
net/ipv4/Kconfig +1 -0
@@ -762,6 +762,7 @@ config TCP_AO config TCP_MD5SIG bool "TCP: MD5 Signature Option support (RFC2385)" select CRYPTO_LIB_MD5 + select CRYPTO_LIB_UTILS help RFC2385 specifies a method of giving MD5 protection to TCP sessions. Its main (only?) use is to protect BGP sessions between core routers
net/ipv4/tcp.c +2 -1
@@ -244,6 +244,7 @@#define pr_fmt (fmt) "TCP: " fmt#include <crypto/md5.h> +#include <crypto/utils.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/types.h>
@@ -4970,7 +4971,7 @@ tcp_inbound_md5_hash(const struct sock *sk, const struct sk_buff *skb,tcp_v4_md5_hash_skb (newhash, key,NULL , skb); else tp->af_specific->calc_md5_hash(newhash, key, NULL, skb); -if (memcmp (hash_location, newhash,16 ) !=0 ) { +if (crypto_memneq (hash_location, newhash,16 )) {NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPMD5FAILURE );trace_tcp_hash_md5_mismatch (sk, skb);return SKB_DROP_REASON_TCP_MD5FAILURE ;
net/ipv4/tcp_ipv4.c +2 -1
@@ -88,6 +88,7 @@#include <linux/skbuff_ref.h> #include <crypto/md5.h> +#include <crypto/utils.h> #include <trace/events/tcp.h>
@@ -839,7 +840,7 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb, goto out;tcp_v4_md5_hash_skb (newhash, key,NULL , skb); -if (memcmp (md5_hash_location, newhash,16 ) !=0 ) +if (crypto_memneq (md5_hash_location, newhash,16 )) goto out; }
net/ipv6/tcp_ipv6.c +2 -1
@@ -68,6 +68,7 @@#include <linux/seq_file.h> #include <crypto/md5.h> +#include <crypto/utils.h> #include <trace/events/tcp.h>
@@ -1048,7 +1049,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb, key.type =TCP_KEY_MD5 ;tcp_v6_md5_hash_skb (newhash, key.md5_key,NULL , skb); -if (memcmp (md5_hash_location, newhash,16 ) !=0 ) +if (crypto_memneq (md5_hash_location, newhash,16 )) goto out; }#endif