From: Doron Roberts-Kedes <doronrk@fb.com>
To: "David S . Miller" <davem@davemloft.net>
Cc: Dave Watson <davejwatson@fb.com>, <netdev@vger.kernel.org>,
Doron Roberts-Kedes <doronrk@fb.com>
Subject: [PATCH net] tls: check RCV_SHUTDOWN in tls_wait_data
Date: Wed, 18 Jul 2018 16:22:27 -0700 [thread overview]
Message-ID: <20180718232227.4083740-1-doronrk@fb.com> (raw)
The current code does not check sk->sk_shutdown & RCV_SHUTDOWN.
tls_sw_recvmsg may return a positive value in the case where bytes have
already been copied when the socket is shutdown. sk->sk_err has been
cleared, causing the tls_wait_data to hang forever on a subsequent
invocation. Checking sk->sk_shutdown & RCV_SHUTDOWN, as in tcp_recvmsg,
fixes this problem.
Fixes: c46234ebb4d1 ("tls: RX path for ktls")
Acked-by: Dave Watson <davejwatson@fb.com>
Signed-off-by: Doron Roberts-Kedes <doronrk@fb.com>
---
net/tls/tls_sw.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index ef15e35232dd..f90c4391f859 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -647,6 +647,9 @@ static struct sk_buff *tls_wait_data(struct sock *sk, int flags,
return NULL;
}
+ if (sk->sk_shutdown & RCV_SHUTDOWN)
+ return NULL;
+
if (sock_flag(sk, SOCK_DONE))
return NULL;
--
2.17.1
next reply other threads:[~2018-07-19 0:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 23:22 Doron Roberts-Kedes [this message]
2018-07-20 21:40 ` [PATCH net] tls: check RCV_SHUTDOWN in tls_wait_data David Miller
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=20180718232227.4083740-1-doronrk@fb.com \
--to=doronrk@fb.com \
--cc=davejwatson@fb.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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