From: Pooja Trivedi <poojatrivedi@gmail.com>
To: borisp@mellanox.com, aviadye@mellanox.com,
john.fastabend@gmail.com, daniel@iogearbox.net, kuba@kernel.org,
davem@davemloft.net, vakul.garg@nxp.com, netdev@vger.kernel.org,
linux-crypto@vger.kernel.org,
mallesham.jatharkonda@oneconvergence.com,
josh.tway@stackpath.com, pooja.trivedi@stackpath.com
Subject: [PATCH net] net/tls(TLS_SW): Fix integrity issue with non-blocking sw KTLS request
Date: Sun, 17 May 2020 16:26:36 +0000 [thread overview]
Message-ID: <1589732796-22839-1-git-send-email-pooja.trivedi@stackpath.com> (raw)
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
next reply other threads:[~2020-05-17 16:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-17 16:26 Pooja Trivedi [this message]
2020-05-18 22:50 ` [PATCH net] net/tls(TLS_SW): Fix integrity issue with non-blocking sw KTLS request 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1589732796-22839-1-git-send-email-pooja.trivedi@stackpath.com \
--to=poojatrivedi@gmail.com \
--cc=aviadye@mellanox.com \
--cc=borisp@mellanox.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=john.fastabend@gmail.com \
--cc=josh.tway@stackpath.com \
--cc=kuba@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=mallesham.jatharkonda@oneconvergence.com \
--cc=netdev@vger.kernel.org \
--cc=pooja.trivedi@stackpath.com \
--cc=vakul.garg@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox