Skip to contentSkip to conversation

Revert "tls: rx: move counting TlsDecryptErrors for sync"

PATCH Applied Gal Pressman 3 participants 3 messages Jul 5, 2022 – Jul 6, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "tls: rx: move counting TlsDecryptErrors for sync"

This reverts commit 284b4d93daee56dff3e10029ddf2e03227f50dbf. When using TLS device offload and coming from tls_device_reencrypt() flow, -EBADMSG error in tls_do_decryption() should not be counted towards the TLSTlsDecryptError counter.

Move the counter increase back to the decrypt_internal() call site in decrypt_skb_update().
This also fixes an issue where:

	if (n_sgin < 1)
		return -EBADMSG;

Errors in decrypt_internal() were not counted after the cited patch.

Fixes 284b4d93daee ("tls: rx: move counting TlsDecryptErrors for sync")
Cc Jakub Kicinski <[email protected]>
---
 net/tls/tls_sw.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/tls/tls_sw.c +4 -4
index 0513f82b8537..e30649f6dde5 100644
@@ -267,9 +267,6 @@ static int tls_do_decryption(struct sock *sk,
 	}
 	darg->async = false;
 
-	if (ret == -EBADMSG)
-		TLS_INC_STATS(sock_net(sk), LINUX_MIB_TLSDECRYPTERROR);
-
 	return ret;
 }
 
@@ -1579,8 +1576,11 @@ static int decrypt_skb_update(struct sock *sk, struct sk_buff *skb,
 	}
 
 	err = decrypt_internal(sk, skb, dest, NULL, darg);
-	if (err < 0)
+	if (err < 0) {
+		if (err == -EBADMSG)
+			TLS_INC_STATS(sock_net(sk), LINUX_MIB_TLSDECRYPTERROR);
 		return err;
+	}
 	if (darg->async)
 		goto decrypt_next;
 
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · On Tue, 5 Jul 2022 14:08:37 +0300 Gal Pressman wrote:

This reverts commit 284b4d93daee56dff3e10029ddf2e03227f50dbf. When using TLS device offload and coming from tls_device_reencrypt() flow, -EBADMSG error in tls_do_decryption() should not be counted towards the TLSTlsDecryptError counter.

Move the counter increase back to the decrypt_internal() call site in decrypt_skb_update().
This also fixes an issue where:

	if (n_sgin < 1)
		return -EBADMSG;
Quoted 7 lines

Errors in decrypt_internal() were not counted after the cited patch.

Fixes 284b4d93daee ("tls: rx: move counting TlsDecryptErrors for sync")
Cc Jakub Kicinski <[email protected]>
#2 lore raw
In reply to Gal Pressman
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 5 lines · On Tue, 5 Jul 2022 14:08:37 +0300 you wrote:

This reverts commit 284b4d93daee56dff3e10029ddf2e03227f50dbf. When using TLS device offload and coming from tls_device_reencrypt() flow, -EBADMSG error in tls_do_decryption() should not be counted towards the TLSTlsDecryptError counter.

Quoted 7 lines

Move the counter increase back to the decrypt_internal() call site in decrypt_skb_update().
This also fixes an issue where:

	if (n_sgin < 1)
		return -EBADMSG;

[...]

Here is the summary with links:
- [net] Revert "tls: rx: move counting TlsDecryptErrors for sync"

    https://git.kernel.org/netdev/net/c/a069a9055416

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html