diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c index b61b893e9204f266ce200430f03bbb8d4497bf87..c9588b682db4eecd69fbcc268d40f3b76a48b334 100644 --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -911,8 +911,6 @@ void tls_device_offload_cleanup_rx(struct sock *sk) } out: up_read(&device_offload_lock); - kfree(tls_ctx->rx.rec_seq); - kfree(tls_ctx->rx.iv); tls_sw_release_resources_rx(sk); } diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index 06f4e78127c07add41aa29cb84775ed0ec582f5a..0bfc757d99f1dca14f4af216479d474ec22b27b8 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c @@ -290,11 +290,8 @@ static void tls_sk_proto_close(struct sock *sk, long timeout) tls_sw_free_resources_tx(sk); } - if (ctx->rx_conf == TLS_SW) { - kfree(ctx->rx.rec_seq); - kfree(ctx->rx.iv); + if (ctx->rx_conf == TLS_SW) tls_sw_free_resources_rx(sk); - } #ifdef CONFIG_TLS_DEVICE if (ctx->rx_conf == TLS_HW) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 5118e3987694fa8ccb39af414c084b127f9a535e..bbb2da70e8701a1231374c84532632ff0d3b181d 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -1120,6 +1120,9 @@ void tls_sw_release_resources_rx(struct sock *sk) struct tls_context *tls_ctx = tls_get_ctx(sk); struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); + kfree(tls_ctx->rx.rec_seq); + kfree(tls_ctx->rx.iv); + if (ctx->aead_recv) { kfree_skb(ctx->recv_pkt); ctx->recv_pkt = NULL;