diff mbox series

[net,7/7] net: tls: fix returned read length with async decrypt

Message ID 20240207011824.2609030-8-kuba@kernel.org (mailing list archive)
State Accepted
Commit ac437a51ce662364062f704e321227f6728e6adc
Delegated to: Netdev Maintainers
Headers show
Series net: tls: fix some issues with async encryption | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1064 this patch: 1064
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 1081 this patch: 1081
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
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: 1081 this patch: 1081
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-10--12-00 (tests: 1262)

Commit Message

Jakub Kicinski Feb. 7, 2024, 1:18 a.m. UTC
We double count async, non-zc rx data. The previous fix was
lucky because if we fully zc async_copy_bytes is 0 so we add 0.
Decrypted already has all the bytes we handled, in all cases.
We don't have to adjust anything, delete the erroneous line.

Fixes: 4d42cd6bc2ac ("tls: rx: fix return value for async crypto")
Co-developed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: borisp@nvidia.com
CC: john.fastabend@gmail.com
CC: horms@kernel.org
---
 net/tls/tls_sw.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Simon Horman Feb. 9, 2024, 9:22 a.m. UTC | #1
On Tue, Feb 06, 2024 at 05:18:24PM -0800, Jakub Kicinski wrote:
> We double count async, non-zc rx data. The previous fix was
> lucky because if we fully zc async_copy_bytes is 0 so we add 0.
> Decrypted already has all the bytes we handled, in all cases.
> We don't have to adjust anything, delete the erroneous line.
> 
> Fixes: 4d42cd6bc2ac ("tls: rx: fix return value for async crypto")
> Co-developed-by: Sabrina Dubroca <sd@queasysnail.net>
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>
Sabrina Dubroca Feb. 10, 2024, 9:02 a.m. UTC | #2
2024-02-06, 17:18:24 -0800, Jakub Kicinski wrote:
> We double count async, non-zc rx data. The previous fix was
> lucky because if we fully zc async_copy_bytes is 0 so we add 0.
> Decrypted already has all the bytes we handled, in all cases.
> We don't have to adjust anything, delete the erroneous line.

I had an adjustment there which I thought was necessary, but I can't
remember why, so let's go with this.

Possibly had to do with partial async cases, since I also played with
a hack to only go async for every other request (or every N requests).
Jakub Kicinski Feb. 12, 2024, 5:11 p.m. UTC | #3
On Sat, 10 Feb 2024 10:02:07 +0100 Sabrina Dubroca wrote:
> 2024-02-06, 17:18:24 -0800, Jakub Kicinski wrote:
> > We double count async, non-zc rx data. The previous fix was
> > lucky because if we fully zc async_copy_bytes is 0 so we add 0.
> > Decrypted already has all the bytes we handled, in all cases.
> > We don't have to adjust anything, delete the erroneous line.  
> 
> I had an adjustment there which I thought was necessary, but I can't
> remember why, so let's go with this.
> 
> Possibly had to do with partial async cases, since I also played with
> a hack to only go async for every other request (or every N requests).

I must have seen some reason to keep it back in 4d42cd6bc2ac as well :S
Let's see if someone complains..
diff mbox series

Patch

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index a6eff21ade23..9fbc70200cd0 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -2132,7 +2132,6 @@  int tls_sw_recvmsg(struct sock *sk,
 		else
 			err = process_rx_list(ctx, msg, &control, 0,
 					      async_copy_bytes, is_peek);
-		decrypted += max(err, 0);
 	}
 
 	copied += decrypted;