All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net/tls(TLS_SW): Fix integrity issue with non-blocking sw KTLS request
@ 2020-05-17 16:26 Pooja Trivedi
  2020-05-18 22:50 ` Jakub Kicinski
  0 siblings, 1 reply; 6+ messages in thread
From: Pooja Trivedi @ 2020-05-17 16:26 UTC (permalink / raw)
  To: borisp, aviadye, john.fastabend, daniel, kuba, davem, vakul.garg,
	netdev, linux-crypto, mallesham.jatharkonda, josh.tway,
	pooja.trivedi

In pure sw ktls(AES-NI), -EAGAIN from tcp layer (do_tcp_sendpages for
encrypted record) gets treated as error, subtracts the offset, and
returns to application. Because of this, application sends data from
subtracted offset, which leads to data integrity issue. Since record is
already encrypted, ktls module marks it as partially sent and pushes the
packet to tcp layer in the following iterations (either from bottom half
or when pushing next chunk). So returning success in case of EAGAIN
will fix the issue.

Fixes: a42055e8d2c3 ("net/tls: Add support for async encryption")
Signed-off-by: Pooja Trivedi <pooja.trivedi@stackpath.com>
Reviewed-by: Mallesham Jatharkonda <mallesham.jatharkonda@oneconvergence.com>
Reviewed-by: Josh Tway <josh.tway@stackpath.com>
---
 net/tls/tls_sw.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index e23f94a..d8ebdfc 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -415,10 +415,12 @@ int tls_tx_records(struct sock *sk, int flags)
 	}
 
 tx_err:
-	if (rc < 0 && rc != -EAGAIN)
+	if (rc < 0 && rc != -EAGAIN) {
 		tls_err_abort(sk, EBADMSG);
+		return rc;
+	}
 
-	return rc;
+	return 0;
 }
 
 static void tls_encrypt_done(struct crypto_async_request *req, int err)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-20 20:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17 16:26 [PATCH net] net/tls(TLS_SW): Fix integrity issue with non-blocking sw KTLS request Pooja Trivedi
2020-05-18 22:50 ` Jakub Kicinski
2020-05-19 17:21   ` Pooja Trivedi
2020-05-19 21:42     ` Jakub Kicinski
2020-05-20 19:56       ` Pooja Trivedi
2020-05-20 20:12         ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.