All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	willemb@google.com
Cc: oss-drivers@netronome.com, davejwatson@fb.com,
	borisp@mellanox.com, aviadye@mellanox.com,
	john.fastabend@gmail.com, daniel@iogearbox.net,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Simon Horman <simon.horman@netronome.com>
Subject: [RFC 1/2] net/tls: don't clear socket error if strparser aborted
Date: Sun,  6 Oct 2019 20:53:22 -0700	[thread overview]
Message-ID: <20191007035323.4360-2-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20191007035323.4360-1-jakub.kicinski@netronome.com>

If strparser encounters an error it reports it on the socket and
stops any further processing. TLS RX will currently pick up that
error code with sock_error(), and report it to user space once.
Subsequent read calls will block indefinitely.

Since the error condition is not cleared and processing is not
restarted it seems more correct to keep returning the error
rather than sleeping.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
---
 net/tls/tls_sw.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index de7561d4cfa5..a9ca2dbe0531 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -1245,8 +1245,11 @@ static struct sk_buff *tls_wait_data(struct sock *sk, struct sk_psock *psock,
 	DEFINE_WAIT_FUNC(wait, woken_wake_function);
 
 	while (!(skb = ctx->recv_pkt) && sk_psock_queue_empty(psock)) {
-		if (sk->sk_err) {
-			*err = sock_error(sk);
+		if (unlikely(sk->sk_err)) {
+			if (ctx->strp.stopped)
+				*err = -sk->sk_err;
+			else
+				*err = sock_error(sk);
 			return NULL;
 		}
 
-- 
2.21.0


  reply	other threads:[~2019-10-07  3:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07  3:53 [RFC 0/2] net/tls: don't block after strparser error Jakub Kicinski
2019-10-07  3:53 ` Jakub Kicinski [this message]
2019-10-07 12:58   ` [RFC 1/2] net/tls: don't clear socket error if strparser aborted David Miller
2019-10-07  3:53 ` [RFC 2/2] selftests/tls: test the small receive buffer case 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=20191007035323.4360-2-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=aviadye@mellanox.com \
    --cc=borisp@mellanox.com \
    --cc=daniel@iogearbox.net \
    --cc=davejwatson@fb.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=simon.horman@netronome.com \
    --cc=willemb@google.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 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.