Skip to content

Commit

Permalink
Revert "tls: rx: move counting TlsDecryptErrors for sync"
Browse files Browse the repository at this point in the history
commit a069a90 upstream.

This reverts commit 284b4d9.
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: 284b4d9 ("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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
gal-pressman authored and gregkh committed Mar 6, 2024
1 parent 9d59322 commit cc5e34b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/tls/tls_sw.c
Expand Up @@ -278,9 +278,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;
}

Expand Down Expand Up @@ -1585,8 +1582,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;

Expand Down

0 comments on commit cc5e34b

Please sign in to comment.