mbox series

[0/2] udp: rescan hash2 list if chains crossed.

Message ID fbcaa54791cd44999de5fec7c6cf0b3c@AcuMS.aculab.com (mailing list archive)
Headers show
Series udp: rescan hash2 list if chains crossed. | expand

Message

David Laight July 26, 2023, 11:51 a.m. UTC
Commit ca065d0cf80fa removed the rescan of the hash2 list (local
address + local port) during udp receive if the final socket
wasn't on the expected hash chain.

While unusual, udp sockets can get rehashed (and without an rcu
delay) without this rescan received packets can generate an unexpected
ICMP port unreachable instead of being delivered to a local socket.

The rescan could be checked for every socket, but the chances of
the hash chain being diverted twice and ending up in the correct
list is pretty minimal.

This is the 'smoking gun' for some ICMP port unreachable messages
being received on long-lived UDP sockets on 127.0.0.1.
The failures are rare and being seen on AWS - so it is pretty
impossible to test the patch.

David Laight (2):
  Move hash calculation inside udp4_lib_lookup2()
  Rescan the hash2 list if the hash chains have got cross-linked.

 net/ipv4/udp.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)