diff mbox series

[net] Revert "tls: rx: move counting TlsDecryptErrors for sync"

Message ID 20220705110837.24633-1-gal@nvidia.com (mailing list archive)
State Accepted
Commit a069a90554168ac4cc81af65f000557d2a8a0745
Delegated to: Netdev Maintainers
Headers show
Series [net] Revert "tls: rx: move counting TlsDecryptErrors for sync" | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 4 maintainers not CCed: john.fastabend@gmail.com borisp@nvidia.com pabeni@redhat.com edumazet@google.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Gal Pressman July 5, 2022, 11:08 a.m. UTC
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 <kuba@kernel.org>
Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
 net/tls/tls_sw.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jakub Kicinski July 5, 2022, 9:41 p.m. UTC | #1
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;
> 
> Errors in decrypt_internal() were not counted after the cited patch.
> 
> Fixes: 284b4d93daee ("tls: rx: move counting TlsDecryptErrors for sync")
> Cc: Jakub Kicinski <kuba@kernel.org>
> Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> Signed-off-by: Gal Pressman <gal@nvidia.com>

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
patchwork-bot+netdevbpf@kernel.org July 6, 2022, 10:10 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

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.
> 
> 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!
diff mbox series

Patch

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 0513f82b8537..e30649f6dde5 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -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;