diff options
author | Vakul Garg <vakul.garg@nxp.com> | 2019-03-12 04:22:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-13 17:16:44 -0400 |
commit | 4504ab0e6eb801555368cbb3011ab0530f659d4b (patch) | |
tree | 22c9992083d02f39318e454246b5ee55189cc9c3 /net/tls/tls_main.c | |
parent | 5b5f99b186906d198f4455b3add911c87ab361fc (diff) |
net/tls: Inform user space about send buffer availability
A previous fix ("tls: Fix write space handling") assumed that
user space application gets informed about the socket send buffer
availability when tls_push_sg() gets called. Inside tls_push_sg(), in
case do_tcp_sendpages() returns 0, the function returns without calling
ctx->sk_write_space. Further, the new function tls_sw_write_space()
did not invoke ctx->sk_write_space. This leads to situation that user
space application encounters a lockup always waiting for socket send
buffer to become available.
Rather than call ctx->sk_write_space from tls_push_sg(), it should be
called from tls_write_space. So whenever tcp stack invokes
sk->sk_write_space after freeing socket send buffer, we always declare
the same to user space by the way of invoking ctx->sk_write_space.
Fixes: 7463d3a2db0ef ("tls: Fix write space handling")
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tls/tls_main.c')
-rw-r--r-- | net/tls/tls_main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index 17e8667917aa..df921a2904b9 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c | |||
@@ -146,7 +146,6 @@ retry: | |||
146 | } | 146 | } |
147 | 147 | ||
148 | ctx->in_tcp_sendpages = false; | 148 | ctx->in_tcp_sendpages = false; |
149 | ctx->sk_write_space(sk); | ||
150 | 149 | ||
151 | return 0; | 150 | return 0; |
152 | } | 151 | } |
@@ -228,6 +227,8 @@ static void tls_write_space(struct sock *sk) | |||
228 | else | 227 | else |
229 | #endif | 228 | #endif |
230 | tls_sw_write_space(sk, ctx); | 229 | tls_sw_write_space(sk, ctx); |
230 | |||
231 | ctx->sk_write_space(sk); | ||
231 | } | 232 | } |
232 | 233 | ||
233 | static void tls_ctx_free(struct tls_context *ctx) | 234 | static void tls_ctx_free(struct tls_context *ctx) |