diff options
author | Doron Roberts-Kedes <doronrk@fb.com> | 2018-07-18 16:22:27 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-20 14:38:14 -0700 |
commit | fcf4793e278edede8fcd748198d12128037e526c (patch) | |
tree | 99b924611fb7e310f49c63db0375b2cfcf2eefac /net | |
parent | f7a6eb1e155d0760a6d62bc17cf665205d43e9b1 (diff) | |
download | linux-fcf4793e278edede8fcd748198d12128037e526c.tar.gz linux-fcf4793e278edede8fcd748198d12128037e526c.tar.bz2 linux-fcf4793e278edede8fcd748198d12128037e526c.zip |
tls: check RCV_SHUTDOWN in tls_wait_data
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/tls/tls_sw.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 4618f1c31137..1f3d9789af30 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -646,6 +646,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; |