From: xin.guo Date: Mon, 7 Oct 2024 08:25:44 +0000 (+0800) Subject: tcp: remove unnecessary update for tp->write_seq in tcp_connect() X-Git-Tag: v6.13-rc1~135^2~374 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d35bd24cea949235d10226576dcf476cf7fdc41d;p=thirdparty%2Fkernel%2Flinux.git tcp: remove unnecessary update for tp->write_seq in tcp_connect() Commit 783237e8daf13 ("net-tcp: Fast Open client - sending SYN-data") introduces tcp_connect_queue_skb() and it would overwrite tcp->write_seq, so it is no need to update tp->write_seq before invoking tcp_connect_queue_skb(). Signed-off-by: xin.guo Link: https://patch.msgid.link/1728289544-4611-1-git-send-email-guoxin0309@gmail.com Signed-off-by: Jakub Kicinski --- diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 08772395690d1..1251510f0e58d 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -4134,7 +4134,10 @@ int tcp_connect(struct sock *sk) if (unlikely(!buff)) return -ENOBUFS; - tcp_init_nondata_skb(buff, tp->write_seq++, TCPHDR_SYN); + /* SYN eats a sequence byte, write_seq updated by + * tcp_connect_queue_skb(). + */ + tcp_init_nondata_skb(buff, tp->write_seq, TCPHDR_SYN); tcp_mstamp_refresh(tp); tp->retrans_stamp = tcp_time_stamp_ts(tp); tcp_connect_queue_skb(sk, buff);