Skip to content

Commit 9f0cadc

Browse files
qsnklassert
authored andcommitted
xfrm: espintcp: save and call old ->sk_destruct
When ESP encapsulation is enabled on a TCP socket, I'm replacing the existing ->sk_destruct callback with espintcp_destruct. We still need to call the old callback to perform the other cleanups when the socket is destroyed. Save the old callback, and call it from espintcp_destruct. Fixes: e27cca9 ("xfrm: add espintcp (RFC 8229)") Signed-off-by: Sabrina Dubroca <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 29e4276 commit 9f0cadc

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

include/net/espintcp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct espintcp_ctx {
2525
struct espintcp_msg partial;
2626
void (*saved_data_ready)(struct sock *sk);
2727
void (*saved_write_space)(struct sock *sk);
28+
void (*saved_destruct)(struct sock *sk);
2829
struct work_struct work;
2930
bool tx_running;
3031
};

net/xfrm/espintcp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ static void espintcp_destruct(struct sock *sk)
379379
{
380380
struct espintcp_ctx *ctx = espintcp_getctx(sk);
381381

382+
ctx->saved_destruct(sk);
382383
kfree(ctx);
383384
}
384385

@@ -419,6 +420,7 @@ static int espintcp_init_sk(struct sock *sk)
419420
sk->sk_socket->ops = &espintcp_ops;
420421
ctx->saved_data_ready = sk->sk_data_ready;
421422
ctx->saved_write_space = sk->sk_write_space;
423+
ctx->saved_destruct = sk->sk_destruct;
422424
sk->sk_data_ready = espintcp_data_ready;
423425
sk->sk_write_space = espintcp_write_space;
424426
sk->sk_destruct = espintcp_destruct;

0 commit comments

Comments
 (0)