Netdev List
 help / color / mirror / Atom feed
From: Rishikesh Jethwani <rjethwani@purestorage.com>
To: netdev@vger.kernel.org
Cc: Rishikesh Jethwani <rjethwani@purestorage.com>,
	stable@vger.kernel.org, John Fastabend <john.fastabend@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Sabrina Dubroca <sd@queasysnail.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	Alice Mikityanska <alice.kernel@fastmail.im>,
	Tariq Toukan <tariqt@nvidia.com>
Subject: [PATCH net v3 2/9] tls: device: keep tls_sw_fallback() from encrypting its own output
Date: Fri,  4 Dec 2026 16:53:49 -0700	[thread overview]
Message-ID: <20261204235642.36653-3-rjethwani@purestorage.com> (raw)
In-Reply-To: <20261204235642.36653-1-rjethwani@purestorage.com>

After the TLS device goes down, TX validation can run the software
fallback at both the bond and its slave. The second pass encrypts
ciphertext with the same keystream and can expose plaintext.

Pass unmarked skbs through tls_sw_fallback() and clear skb->decrypted
on its output. Backport the preceding fragmentation fix first:
otherwise fragments of offload plaintext can also arrive unmarked.

Found by manual inspection. On two mlx5 hosts with TLS 1.2 AES-GCM-128,
both the idle and in-flight bond bounce tests returned a mismatched
echo without the fix and passed with it.

Fixes: c55dcdd435aa ("net/tls: Fix use-after-free after the TLS device goes down and up")
Cc: <stable@vger.kernel.org> # 5.10.x: fc6d80eb5044: tcp: prevent collapsing skbs across boundary in rtx queue
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
 net/tls/tls_device_fallback.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/tls/tls_device_fallback.c b/net/tls/tls_device_fallback.c
index b547027cc879..42afbe7e60b5 100644
--- a/net/tls/tls_device_fallback.c
+++ b/net/tls/tls_device_fallback.c
@@ -192,6 +192,9 @@ static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln)
 	skb->destructor = NULL;
 	skb->sk = NULL;
 
+	/* Ciphertext now: don't encrypt it again */
+	nskb->decrypted = 0;
+
 	update_chksum(nskb, headln);
 
 	/* sock_efree means skb must gone through skb_orphan_partial() */
@@ -371,6 +374,10 @@ static struct sk_buff *tls_sw_fallback(struct sock *sk, struct sk_buff *skb)
 	s32 sync_size = 0;
 	u64 rcd_sn;
 
+	/* Pre-offload data or tls_sw_fallback() output */
+	if (!skb_is_decrypted(skb))
+		return skb;
+
 	/* worst case is:
 	 * MAX_SKB_FRAGS in tls_record_info
 	 * MAX_SKB_FRAGS + 1 in SKB head and frags.
-- 
2.50.1


  parent reply	other threads:[~2026-12-04 23:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 1/9] net: don't fragment skbs that still need device crypto Rishikesh Jethwani
2026-12-04 23:53 ` Rishikesh Jethwani [this message]
2026-12-04 23:53 ` [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 4/9] tls: device: remove the dead start marker bypass in TX fallback Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg() Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 8/9] selftests: net: test TLS fallback after rerouting to an upper device Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 9/9] selftests: net: verify that IP refuses to fragment TLS offload data Rishikesh Jethwani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204235642.36653-3-rjethwani@purestorage.com \
    --to=rjethwani@purestorage.com \
    --cc=alice.kernel@fastmail.im \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=stable@vger.kernel.org \
    --cc=tariqt@nvidia.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox