netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/ipv4/tcp.c: cleanup duplicate initialization of sk->sk_state in tcp_init_sock()
@ 2019-12-08 14:31 kuni1840
  2019-12-09 17:53 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: kuni1840 @ 2019-12-08 14:31 UTC (permalink / raw)
  To: edumazet, davem, kuznet, yoshfuji; +Cc: netdev, kuniyu, Kuniyuki Iwashima

From: Kuniyuki Iwashima <kuni1840@gmail.com>

When a TCP socket is created, sk->sk_state is initialized twice as
TCP_CLOSE in sock_init_data() and tcp_init_sock(). The tcp_init_sock() is
always called after the sock_init_data(), so it is not necessary to update
sk->sk_state in the tcp_init_sock().

Before v2.1.8, the code of the two functions was in the inet_create(). In
the patch of v2.1.8, the tcp_v4/v6_init_sock() were added and the code of
initialization of sk->state was duplicated.

Signed-off-by: Kuniyuki Iwashima <kuni1840@gmail.com>
---
 net/ipv4/tcp.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 8a39ee794891..09e2cae92956 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -443,8 +443,6 @@ void tcp_init_sock(struct sock *sk)
 	tp->tsoffset = 0;
 	tp->rack.reo_wnd_steps = 1;
 
-	sk->sk_state = TCP_CLOSE;
-
 	sk->sk_write_space = sk_stream_write_space;
 	sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
 
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/ipv4/tcp.c: cleanup duplicate initialization of sk->sk_state in tcp_init_sock()
  2019-12-08 14:31 [PATCH] net/ipv4/tcp.c: cleanup duplicate initialization of sk->sk_state in tcp_init_sock() kuni1840
@ 2019-12-09 17:53 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-12-09 17:53 UTC (permalink / raw)
  To: kuni1840; +Cc: edumazet, kuznet, yoshfuji, netdev, kuniyu

From: kuni1840@gmail.com
Date: Sun,  8 Dec 2019 14:31:27 +0000

> From: Kuniyuki Iwashima <kuni1840@gmail.com>
> 
> When a TCP socket is created, sk->sk_state is initialized twice as
> TCP_CLOSE in sock_init_data() and tcp_init_sock(). The tcp_init_sock() is
> always called after the sock_init_data(), so it is not necessary to update
> sk->sk_state in the tcp_init_sock().
> 
> Before v2.1.8, the code of the two functions was in the inet_create(). In
> the patch of v2.1.8, the tcp_v4/v6_init_sock() were added and the code of
> initialization of sk->state was duplicated.
> 
> Signed-off-by: Kuniyuki Iwashima <kuni1840@gmail.com>

Please format your Subject line correctly, it should be of the form:

	Subject: [PATCH $PATCH_VERSION $TARGET_GIT_TREE] subsystem_prefix: Description.

Using a source file path in the Subject line is not appropriate.

So when you respin this patch you could say:

	Subject: [PATCH v2 net-next] tcp: Cleanup duplicate initialization of sk->sk_state.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-09 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-08 14:31 [PATCH] net/ipv4/tcp.c: cleanup duplicate initialization of sk->sk_state in tcp_init_sock() kuni1840
2019-12-09 17:53 ` David Miller

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).