]> git.baikalelectronics.ru Git - kernel.git/commit
Revert "tcp/dccp: get rid of inet_twsk_purge()"
authorEric Dumazet <edumazet@google.com>
Thu, 12 May 2022 21:14:56 +0000 (14:14 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 May 2022 11:24:12 +0000 (12:24 +0100)
commit02bbcd40f6dbcdac74a63e1a495cfa2e15a93a9f
treed503c898ffaeac241b9281b8d54f9eada79c8363
parentf7af9034c6e0f7cb1eee7e4d365aa1d432fe0e4b
Revert "tcp/dccp: get rid of inet_twsk_purge()"

This reverts commits:

8824bc0f9c93f6f07c4a81a30df4a8440ba9f6c4 ("tcp/dccp: get rid of inet_twsk_purge()")
bc3343585f9fb2988faf858ce5f1f85b82045609 ("tcp/dccp: add tw->tw_bslot")

As Leonard pointed out, a newly allocated netns can happen
to reuse a freed 'struct net'.

While TCP TW timers were covered by my patches, other things were not:

1) Lookups in rx path (INET_MATCH() and INET6_MATCH()), as they look
  at 4-tuple plus the 'struct net' pointer.

2) /proc/net/tcp[6] and inet_diag, same reason.

3) hashinfo->bhash[], same reason.

Fixing all this seems risky, lets instead revert.

In the future, we might have a per netns tcp hash table, or
a per netns list of timewait sockets...

Fixes: 8824bc0f9c93 ("tcp/dccp: get rid of inet_twsk_purge()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Leonard Crestez <cdleonard@gmail.com>
Tested-by: Leonard Crestez <cdleonard@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/inet_timewait_sock.h
net/dccp/ipv4.c
net/dccp/ipv6.c
net/ipv4/inet_timewait_sock.c
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c