[PATCH v3 2/8] net/handshake: Define handshake_sk_destruct_req

alistair23@gmail.com posted 8 patches 1 day, 9 hours ago
[PATCH v3 2/8] net/handshake: Define handshake_sk_destruct_req
Posted by alistair23@gmail.com 1 day, 9 hours ago
From: Alistair Francis <alistair.francis@wdc.com>

Define a `handshake_sk_destruct_req()` function to allow the destruction
of the handshake req.

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@wdc.com>
---
v3:
 - New patch

 net/handshake/request.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/net/handshake/request.c b/net/handshake/request.c
index 274d2c89b6b2..0d1c91c80478 100644
--- a/net/handshake/request.c
+++ b/net/handshake/request.c
@@ -98,6 +98,22 @@ static void handshake_sk_destruct(struct sock *sk)
 		sk_destruct(sk);
 }
 
+/**
+ * handshake_sk_destruct_req - destroy an existing request
+ * @sk: socket on which there is an existing request
+ */
+static 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);
+}
+
 /**
  * handshake_req_alloc - Allocate a handshake request
  * @proto: security protocol
-- 
2.51.0
Re: [PATCH v3 2/8] net/handshake: Define handshake_sk_destruct_req
Posted by Simon Horman 1 day, 4 hours ago
On Fri, Oct 03, 2025 at 02:31:33PM +1000, alistair23@gmail.com wrote:
> From: Alistair Francis <alistair.francis@wdc.com>
> 
> Define a `handshake_sk_destruct_req()` function to allow the destruction
> of the handshake req.
> 
> 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@wdc.com>
> ---
> v3:
>  - New patch

Hi Alistair,

This is a not a proper review: I'll leave that to others.
But I notice that both Clang 21.1.1 and GCC 15.2.0, when run with
-Wunused-function, flag handshake_sk_descruct_req() as unused.
Which is the case until the following patch.

As both this and the following patch are small, and touch the same file,
I'm wondering if a simple approach is to squash the two patches into one.

Or perhaps no one cares. If so, sorry for the noise.

...