lkml.org 
[lkml]   [2020]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.6 147/177] xfrm: espintcp: save and call old ->sk_destruct
    Date
    From: Sabrina Dubroca <sd@queasysnail.net>

    commit 9f0cadc32d738f0f0c8e30be83be7087c7b85ee5 upstream.

    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>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    include/net/espintcp.h | 1 +
    net/xfrm/espintcp.c | 2 ++
    2 files changed, 3 insertions(+)

    --- 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;
    };
    --- a/net/xfrm/espintcp.c
    +++ b/net/xfrm/espintcp.c
    @@ -379,6 +379,7 @@ static void espintcp_destruct(struct soc
    {
    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_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;

    \
     
     \ /
      Last update: 2020-06-01 20:20    [W:4.867 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site