net/ipv4/tcp.c: cleanup duplicate initialization of sk->sk_state in tcp_init_sock()
Subsystems (3)
PATCH 1/1 net/ipv4/tcp.c: cleanup duplicate initialization of sk->sk_state in tcp_init_sock()
From: Kuniyuki Iwashima <[email protected]>
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.
--- net/ipv4/tcp.c | 2 -- 1 file changed, 2 deletions(-)
net/ipv4/tcp.c +0 -2
@@ -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 );
Signature · 1 line
2.17.2
David Miller
maintainerFrom: [email protected]
Date: Sun, 8 Dec 2019 14:31:27 +0000
Quoted 7 lines
From: Kuniyuki Iwashima <[email protected]>
When a TCP socket is created,
sk->sk_stateis initialized twice asTCP_CLOSEinsock_init_data()andtcp_init_sock(). Thetcp_init_sock()is always called after thesock_init_data(), so it is not necessary to updatesk->sk_statein thetcp_init_sock().
Quoted 5 lines
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 ofsk->statewas duplicated.Signed-off-by Kuniyuki Iwashima <[email protected]>
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.