Message ID | c80bbd6e7c810cdf062bcb6937f259205f914b9a.1694018970.git.sd@queasysnail.net (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | tls: fix some issues with async encryption | expand |
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index f23cceaceb36..babbd43d41ed 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -2132,7 +2132,13 @@ 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); + + if (err > 0) { + /* decrypted already accounts for async_copy_bytes, + * we don't want to double-count + */ + decrypted += err - async_copy_bytes; + } } copied += decrypted;
We can double-count the chunk size: - once via decrypted - once in async_copy_bytes, which then becomes part of process_rx_list's return value Subtract it from decrypted before adding in process_rx_list's return value. Fixes: 4d42cd6bc2ac ("tls: rx: fix return value for async crypto") Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> --- This logic is so complex, in this series I'm just trying to make all the selftests pass at the same time :/ net/tls/tls_sw.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)