diff options
Diffstat (limited to 'net/tls/tls_main.c')
-rw-r--r-- | net/tls/tls_main.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index 4b57ddd72f34..301f22430469 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,14 @@ 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->tx_conf == TLS_HW_RECORD && ctx->rx_conf == TLS_HW_RECORD) | 257 | if ((ctx->tx_conf == TLS_HW_RECORD && ctx->rx_conf == TLS_HW_RECORD) || |
256 | goto skip_tx_cleanup; | 258 | (ctx->tx_conf == TLS_BASE && ctx->rx_conf == TLS_BASE)) { |
257 | 259 | free_ctx = true; | |
258 | if (ctx->tx_conf == TLS_BASE && ctx->rx_conf == TLS_BASE) { | ||
259 | kfree(ctx); | ||
260 | ctx = NULL; | ||
261 | goto skip_tx_cleanup; | 260 | goto skip_tx_cleanup; |
262 | } | 261 | } |
263 | 262 | ||
@@ -305,8 +304,7 @@ skip_tx_cleanup: | |||
305 | /* free ctx for TLS_HW_RECORD, used by tcp_set_state | 304 | /* free ctx for TLS_HW_RECORD, used by tcp_set_state |
306 | * for sk->sk_prot->unhash [tls_hw_unhash] | 305 | * for sk->sk_prot->unhash [tls_hw_unhash] |
307 | */ | 306 | */ |
308 | if (ctx && ctx->tx_conf == TLS_HW_RECORD && | 307 | if (free_ctx) |
309 | ctx->rx_conf == TLS_HW_RECORD) | ||
310 | kfree(ctx); | 308 | kfree(ctx); |
311 | } | 309 | } |
312 | 310 | ||