Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Christoph Paasch <christoph.paasch@uclouvain.be>
Cc: "H.K. Jerry Chu" <hkchu@google.com>,
	davem@davemloft.net, netdev@vger.kernel.org,
	ncardwell@google.com, edumazet@google.com
Subject: Re: [PATCH] tcp: Fixed a TFO server bug that crashed kernel by raw sockets
Date: Wed, 19 Sep 2012 07:12:06 +0200	[thread overview]
Message-ID: <1348031526.26523.278.camel@edumazet-glaptop> (raw)
In-Reply-To: <4380003.jOHRfqhomY@cpaasch-mac>

On Wed, 2012-09-19 at 02:19 +0200, Christoph Paasch wrote:

> Why not moving the TCP-code out of inet_sock_destruct by modifying the sk_destruct
> callback when TFO is in use? Like the below (only compile-tested) patch. That
> way inet_sock_destruct stays TFO-free.
> 
> 
> Cheers,
> Christoph
> 
> ---------
> 
> From: Christoph Paasch <christoph.paasch@uclouvain.be>
> Date: Wed, 19 Sep 2012 02:06:53 +0200
> Subject: [PATCH] Don't add TCP-code in inet_sock_destruct
> 
> Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> ---
>  include/linux/tcp.h |    4 ++++
>  net/ipv4/af_inet.c  |    2 --
>  net/ipv4/tcp.c      |    7 +++++++
>  3 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/tcp.h b/include/linux/tcp.h
> index ae46df5..67c789a 100644
> --- a/include/linux/tcp.h
> +++ b/include/linux/tcp.h
> @@ -574,6 +574,8 @@ static inline bool fastopen_cookie_present(struct tcp_fastopen_cookie *foc)
>  	return foc->len != -1;
>  }
>  
> +extern void tcp_sock_destruct(struct sock *sk);
> +
>  static inline int fastopen_init_queue(struct sock *sk, int backlog)
>  {
>  	struct request_sock_queue *queue =
> @@ -585,6 +587,8 @@ static inline int fastopen_init_queue(struct sock *sk, int backlog)
>  		    sk->sk_allocation);
>  		if (queue->fastopenq == NULL)
>  			return -ENOMEM;
> +
> +		sk->sk_destruct = tcp_sock_destruct;
>  		spin_lock_init(&queue->fastopenq->lock);

Yes, it seems much better, thanks !

Acked-by: Eric Dumazet <edumazet@google.com>

  parent reply	other threads:[~2012-09-19  5:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18 23:35 [PATCH] tcp: Fixed a TFO server bug that crashed kernel by raw sockets H.K. Jerry Chu
2012-09-19  0:19 ` Christoph Paasch
2012-09-19  2:14   ` Jerry Chu
2012-09-19  5:12   ` Eric Dumazet [this message]
2012-09-20 21:13   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348031526.26523.278.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=christoph.paasch@uclouvain.be \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkchu@google.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox