* [PATCH ipsec] xfrm: espintcp: save and call old ->sk_destruct
@ 2020-04-16 15:45 Sabrina Dubroca
2020-04-20 10:41 ` Steffen Klassert
0 siblings, 1 reply; 2+ messages in thread
From: Sabrina Dubroca @ 2020-04-16 15:45 UTC (permalink / raw)
To: netdev; +Cc: Steffen Klassert, Sabrina Dubroca
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: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
include/net/espintcp.h | 1 +
net/xfrm/espintcp.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/include/net/espintcp.h b/include/net/espintcp.h
index dd7026a00066..0335bbd76552 100644
--- a/include/net/espintcp.h
+++ b/include/net/espintcp.h
@@ -25,6 +25,7 @@ struct espintcp_ctx {
struct espintcp_msg partial;
void (*saved_data_ready)(struct sock *sk);
void (*saved_write_space)(struct sock *sk);
+ void (*saved_destruct)(struct sock *sk);
struct work_struct work;
bool tx_running;
};
diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c
index 037ea156d2f9..5a0ff665b71a 100644
--- a/net/xfrm/espintcp.c
+++ b/net/xfrm/espintcp.c
@@ -379,6 +379,7 @@ static void espintcp_destruct(struct sock *sk)
{
struct espintcp_ctx *ctx = espintcp_getctx(sk);
+ ctx->saved_destruct(sk);
kfree(ctx);
}
@@ -419,6 +420,7 @@ static int espintcp_init_sk(struct sock *sk)
sk->sk_socket->ops = &espintcp_ops;
ctx->saved_data_ready = sk->sk_data_ready;
ctx->saved_write_space = sk->sk_write_space;
+ ctx->saved_destruct = sk->sk_destruct;
sk->sk_data_ready = espintcp_data_ready;
sk->sk_write_space = espintcp_write_space;
sk->sk_destruct = espintcp_destruct;
--
2.26.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH ipsec] xfrm: espintcp: save and call old ->sk_destruct
2020-04-16 15:45 [PATCH ipsec] xfrm: espintcp: save and call old ->sk_destruct Sabrina Dubroca
@ 2020-04-20 10:41 ` Steffen Klassert
0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2020-04-20 10:41 UTC (permalink / raw)
To: Sabrina Dubroca; +Cc: netdev
On Thu, Apr 16, 2020 at 05:45:44PM +0200, Sabrina Dubroca wrote:
> 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: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Applied, thanks Sabrina!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-20 10:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 15:45 [PATCH ipsec] xfrm: espintcp: save and call old ->sk_destruct Sabrina Dubroca
2020-04-20 10:41 ` Steffen Klassert
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.