[PATCH v2 2/2] tcp/dcpp: Don't disable bh around timewait_sock initialization

From: Valentin Schneider
Date: Wed Nov 15 2023 - 16:05:54 EST


Now that the tw_timer is armed *after* the hashdance, it is the last step
of the timewait initialization. We can thus enable softirqs without running
the risk of the timer handler running before the initialization is done.

This is conceptually a revert of
cfac7f836a71 ("tcp/dccp: block bh before arming time_wait timer")

Signed-off-by: Valentin Schneider <vschneid@xxxxxxxxxx>
---
net/dccp/minisocks.c | 4 ----
net/ipv4/tcp_minisocks.c | 4 ----
2 files changed, 8 deletions(-)

diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 2f0fad4255e36..cb990bc92a5c9 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -53,15 +53,11 @@ void dccp_time_wait(struct sock *sk, int state, int timeo)
if (state == DCCP_TIME_WAIT)
timeo = DCCP_TIMEWAIT_LEN;

- local_bh_disable();
-
// Linkage updates
inet_twsk_hashdance(tw, sk, &dccp_hashinfo);
inet_twsk_schedule(tw, timeo);
// Access to tw after this point is illegal.
inet_twsk_put(tw);
-
- local_bh_enable();
} else {
/* Sorry, if we're out of memory, just CLOSE this
* socket up. We've got bigger problems than
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 48eb0310fe837..c7d46674d55cb 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -338,15 +338,11 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
if (state == TCP_TIME_WAIT)
timeo = TCP_TIMEWAIT_LEN;

- local_bh_disable();
-
// Linkage updates.
inet_twsk_hashdance(tw, sk, net->ipv4.tcp_death_row.hashinfo);
inet_twsk_schedule(tw, timeo);
// Access to tw after this point is illegal.
inet_twsk_put(tw);
-
- local_bh_enable();
} else {
/* Sorry, if we're out of memory, just CLOSE this
* socket up. We've got bigger problems than
--
2.41.0