|
@@ -248,16 +248,13 @@ static void tls_sk_proto_close(struct sock *sk, long timeout)
|
|
|
struct tls_context *ctx = tls_get_ctx(sk);
|
|
|
long timeo = sock_sndtimeo(sk, 0);
|
|
|
void (*sk_proto_close)(struct sock *sk, long timeout);
|
|
|
+ bool free_ctx = false;
|
|
|
|
|
|
lock_sock(sk);
|
|
|
sk_proto_close = ctx->sk_proto_close;
|
|
|
|
|
|
- if (ctx->conf == TLS_HW_RECORD)
|
|
|
- goto skip_tx_cleanup;
|
|
|
-
|
|
|
- if (ctx->conf == TLS_BASE) {
|
|
|
- kfree(ctx);
|
|
|
- ctx = NULL;
|
|
|
+ if (ctx->conf == TLS_BASE || ctx->conf == TLS_HW_RECORD) {
|
|
|
+ free_ctx = true;
|
|
|
goto skip_tx_cleanup;
|
|
|
}
|
|
|
|
|
@@ -294,7 +291,7 @@ skip_tx_cleanup:
|
|
|
/* free ctx for TLS_HW_RECORD, used by tcp_set_state
|
|
|
* for sk->sk_prot->unhash [tls_hw_unhash]
|
|
|
*/
|
|
|
- if (ctx && ctx->conf == TLS_HW_RECORD)
|
|
|
+ if (free_ctx)
|
|
|
kfree(ctx);
|
|
|
}
|
|
|
|