[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180718232227.4083740-1-doronrk@fb.com>
Date: Wed, 18 Jul 2018 16:22:27 -0700
From: Doron Roberts-Kedes <doronrk@...com>
To: "David S . Miller" <davem@...emloft.net>
CC: Dave Watson <davejwatson@...com>, <netdev@...r.kernel.org>,
Doron Roberts-Kedes <doronrk@...com>
Subject: [PATCH net] 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@...com>
Signed-off-by: Doron Roberts-Kedes <doronrk@...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
Powered by blists - more mailing lists