git: d01db2b83705 - main - ktls: Don't leak ktls session objects for certain errors.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sat, 12 Nov 2022 00:01:29 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=d01db2b83705eb3557a32ea13143997cdb8135a3

commit d01db2b83705eb3557a32ea13143997cdb8135a3
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-11-12 00:00:37 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-11-12 00:00:37 +0000

    ktls: Don't leak ktls session objects for certain errors.
    
    ktls_cleanup() does not free ktls session objects, it merely
    cleans (and frees) members of the object.
    
    Change callers to use ktls_free() instead.
    
    Reviewed by:    gallatin, markj
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D37352
---
 sys/kern/uipc_ktls.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c
index b4e5004ed1f8..8f3a204cbd84 100644
--- a/sys/kern/uipc_ktls.c
+++ b/sys/kern/uipc_ktls.c
@@ -744,7 +744,7 @@ ktls_create_session(struct socket *so, struct tls_enable *en,
 	return (0);
 
 out:
-	ktls_cleanup(tls);
+	ktls_free(tls);
 	return (error);
 }
 
@@ -1309,7 +1309,7 @@ ktls_enable_rx(struct socket *so, struct tls_enable *en)
 
 	error = ktls_ocf_try(so, tls, KTLS_RX);
 	if (error) {
-		ktls_cleanup(tls);
+		ktls_free(tls);
 		return (error);
 	}
 
@@ -1387,13 +1387,13 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en)
 		error = ktls_try_sw(so, tls, KTLS_TX);
 
 	if (error) {
-		ktls_cleanup(tls);
+		ktls_free(tls);
 		return (error);
 	}
 
 	error = SOCK_IO_SEND_LOCK(so, SBL_WAIT);
 	if (error) {
-		ktls_cleanup(tls);
+		ktls_free(tls);
 		return (error);
 	}