[PATCH 3/8] net/handshake: Expose handshake_sk_destruct_req publically
alistair23 at gmail.com
alistair23 at gmail.com
Thu Aug 14 22:02:05 PDT 2025
From: Alistair Francis <alistair.francis at wdc.com>
Define a `handshake_sk_destruct_req()` function and expose it publically
so that other subsystems can destruct the handshake req.
This will be used as part of the KeyUpdate to ensure any existing
requests anre cancelled and destructed if required.
This is required to avoid hash conflicts when handshake_req_hash_add()
is called as part of submitting the KeyUpdate request.
Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
---
include/net/handshake.h | 1 +
net/handshake/request.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/net/handshake.h b/include/net/handshake.h
index 8a64729614e1..fab4760049c6 100644
--- a/include/net/handshake.h
+++ b/include/net/handshake.h
@@ -43,6 +43,7 @@ int tls_server_hello_psk(const struct tls_handshake_args *args, gfp_t flags);
bool tls_handshake_cancel(struct sock *sk);
void tls_handshake_close(struct socket *sock);
+void handshake_sk_destruct_req(struct sock *sk);
bool handshake_req_cancel(struct sock *sk);
u8 tls_get_record_type(const struct sock *sk, const struct cmsghdr *msg);
diff --git a/net/handshake/request.c b/net/handshake/request.c
index 274d2c89b6b2..bb727a9ad042 100644
--- a/net/handshake/request.c
+++ b/net/handshake/request.c
@@ -341,3 +341,20 @@ bool handshake_req_cancel(struct sock *sk)
return true;
}
EXPORT_SYMBOL(handshake_req_cancel);
+
+/**
+ * handshake_sk_destruct_req - destroy an existing request
+ * @sk: socket on which there is an existing request
+ */
+void handshake_sk_destruct_req(struct sock *sk)
+{
+ struct handshake_req *req;
+
+ req = handshake_req_hash_lookup(sk);
+ if (!req)
+ return;
+
+ trace_handshake_destruct(sock_net(sk), req, sk);
+ handshake_req_destroy(req);
+}
+EXPORT_SYMBOL(handshake_sk_destruct_req);
--
2.50.1
More information about the Linux-nvme
mailing list