netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: hkchu@google.com
Cc: netdev@vger.kernel.org, ncardwell@google.com, ycheng@google.com
Subject: Re: [PATCH] tcp: Reject invalid ack_seq to Fast Open sockets
Date: Tue, 23 Oct 2012 02:43:47 -0400 (EDT)	[thread overview]
Message-ID: <20121023.024347.596104752673410505.davem@davemloft.net> (raw)
In-Reply-To: <1350941196-31224-1-git-send-email-hkchu@google.com>

From: "H.K. Jerry Chu" <hkchu@google.com>
Date: Mon, 22 Oct 2012 14:26:36 -0700

> From: Jerry Chu <hkchu@google.com>
> 
> A packet with an invalid ack_seq may cause a TCP Fast Open socket to switch
> to the unexpected TCP_CLOSING state, triggering a BUG_ON kernel panic.
> 
> When a FIN packet with an invalid ack_seq# arrives at a socket in
> the TCP_FIN_WAIT1 state, rather than discarding the packet, the current
> code will accept the FIN, causing state transition to TCP_CLOSING.
> 
> This may be a small deviation from RFC793, which seems to say that the
> packet should be dropped. Unfortunately I did not expect this case for
> Fast Open hence it will trigger a BUG_ON panic.
> 
> It turns out there is really nothing bad about a TFO socket going into
> TCP_CLOSING state so I could just remove the BUG_ON statements. But after
> some thought I think it's better to treat this case like TCP_SYN_RECV
> and return a RST to the confused peer who caused the unacceptable ack_seq
> to be generated in the first place.
> 
> Signed-off-by: H.K. Jerry Chu <hkchu@google.com>

Applied, thanks.

> -		BUG_ON(sk->sk_state != TCP_SYN_RECV &&
> +		WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV &&
>  		    sk->sk_state != TCP_FIN_WAIT1);

I fixed up the indentation of the second line of the test when I
applied this.

      parent reply	other threads:[~2012-10-23  6:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 21:26 [PATCH] tcp: Reject invalid ack_seq to Fast Open sockets H.K. Jerry Chu
2012-10-22 21:46 ` Yuchung Cheng
2012-10-22 21:59 ` Eric Dumazet
2012-10-23  0:56 ` Neal Cardwell
2012-10-23  6:43 ` David Miller [this message]

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=20121023.024347.596104752673410505.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=hkchu@google.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=ycheng@google.com \
    /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;
as well as URLs for NNTP newsgroup(s).