aboutsummaryrefslogtreecommitdiffstats
path: root/net/tls/tls_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tls/tls_main.c')
-rw-r--r--net/tls/tls_main.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index cc03e00785c7..20cd93be6236 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -135,6 +135,7 @@ retry:
135 offset -= sg->offset; 135 offset -= sg->offset;
136 ctx->partially_sent_offset = offset; 136 ctx->partially_sent_offset = offset;
137 ctx->partially_sent_record = (void *)sg; 137 ctx->partially_sent_record = (void *)sg;
138 ctx->in_tcp_sendpages = false;
138 return ret; 139 return ret;
139 } 140 }
140 141
@@ -248,16 +249,13 @@ static void tls_sk_proto_close(struct sock *sk, long timeout)
248 struct tls_context *ctx = tls_get_ctx(sk); 249 struct tls_context *ctx = tls_get_ctx(sk);
249 long timeo = sock_sndtimeo(sk, 0); 250 long timeo = sock_sndtimeo(sk, 0);
250 void (*sk_proto_close)(struct sock *sk, long timeout); 251 void (*sk_proto_close)(struct sock *sk, long timeout);
252 bool free_ctx = false;
251 253
252 lock_sock(sk); 254 lock_sock(sk);
253 sk_proto_close = ctx->sk_proto_close; 255 sk_proto_close = ctx->sk_proto_close;
254 256
255 if (ctx->conf == TLS_HW_RECORD) 257 if (ctx->conf == TLS_BASE || ctx->conf == TLS_HW_RECORD) {
256 goto skip_tx_cleanup; 258 free_ctx = true;
257
258 if (ctx->conf == TLS_BASE) {
259 kfree(ctx);
260 ctx = NULL;
261 goto skip_tx_cleanup; 259 goto skip_tx_cleanup;
262 } 260 }
263 261
@@ -294,7 +292,7 @@ skip_tx_cleanup:
294 /* free ctx for TLS_HW_RECORD, used by tcp_set_state 292 /* free ctx for TLS_HW_RECORD, used by tcp_set_state
295 * for sk->sk_prot->unhash [tls_hw_unhash] 293 * for sk->sk_prot->unhash [tls_hw_unhash]
296 */ 294 */
297 if (ctx && ctx->conf == TLS_HW_RECORD) 295 if (free_ctx)
298 kfree(ctx); 296 kfree(ctx);
299} 297}
300 298