From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
borisp@nvidia.com, john.fastabend@gmail.com, maximmi@nvidia.com,
tariqt@nvidia.com, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 3/4] tls: rx: fix the NoPad getsockopt
Date: Fri, 8 Jul 2022 19:52:54 -0700 [thread overview]
Message-ID: <20220709025255.323864-4-kuba@kernel.org> (raw)
In-Reply-To: <20220709025255.323864-1-kuba@kernel.org>
Maxim reports do_tls_getsockopt_no_pad() will
always return an error. Indeed looks like refactoring
gone wrong - remove err and use value.
Reported-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Fixes: 88527790c079 ("tls: rx: add sockopt for enabling optimistic decrypt with TLS 1.3")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/tls/tls_main.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index f3d9dbfa507e..f71b46568112 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -539,8 +539,7 @@ static int do_tls_getsockopt_no_pad(struct sock *sk, char __user *optval,
int __user *optlen)
{
struct tls_context *ctx = tls_get_ctx(sk);
- unsigned int value;
- int err, len;
+ int value, len;
if (ctx->prot_info.version != TLS_1_3_VERSION)
return -EINVAL;
@@ -551,12 +550,12 @@ static int do_tls_getsockopt_no_pad(struct sock *sk, char __user *optval,
return -EINVAL;
lock_sock(sk);
- err = -EINVAL;
+ value = -EINVAL;
if (ctx->rx_conf == TLS_SW || ctx->rx_conf == TLS_HW)
value = ctx->rx_no_pad;
release_sock(sk);
- if (err)
- return err;
+ if (value < 0)
+ return value;
if (put_user(sizeof(value), optlen))
return -EFAULT;
--
2.36.1
next prev parent reply other threads:[~2022-07-09 2:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-09 2:52 [PATCH net-next 0/4] tls: rx: follow-ups to NoPad Jakub Kicinski
2022-07-09 2:52 ` [PATCH net-next 1/4] tls: fix spelling of MIB Jakub Kicinski
2022-07-09 2:52 ` [PATCH net-next 2/4] tls: rx: add counter for NoPad violations Jakub Kicinski
2022-07-09 2:52 ` Jakub Kicinski [this message]
2022-07-09 2:52 ` [PATCH net-next 4/4] selftests: tls: add test for NoPad getsockopt Jakub Kicinski
2022-07-12 5:50 ` [PATCH net-next 0/4] tls: rx: follow-ups to NoPad patchwork-bot+netdevbpf
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=20220709025255.323864-4-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=borisp@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=john.fastabend@gmail.com \
--cc=maximmi@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tariqt@nvidia.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;
as well as URLs for NNTP newsgroup(s).