deepin-kernel/net/ipv4
Philo Lu 21f827b07c udp: Make rehash4 independent in udp_lib_rehash()
[ Upstream commit 644f9108f3 ]

As discussed in [0], rehash4 could be missed in udp_lib_rehash() when
udp hash4 changes while hash2 doesn't change. This patch fixes this by
moving rehash4 codes out of rehash2 checking, and then rehash2 and
rehash4 are done separately.

By doing this, we no longer need to call rehash4 explicitly in
udp_lib_hash4(), as the rehash callback in __ip4_datagram_connect takes
it. Thus, now udp_lib_hash4() returns directly if the sk is already
hashed.

Note that uhash4 may fail to work under consecutive connect(<dst
address>) calls because rehash() is not called with every connect(). To
overcome this, connect(<AF_UNSPEC>) needs to be called after the next
connect to a new destination.

[0]
https://lore.kernel.org/all/4761e466ab9f7542c68cdc95f248987d127044d2.1733499715.git.pabeni@redhat.com/

Fixes: 78c91ae2c6 ("ipv4/udp: Add 4-tuple hash for connected socket")
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Philo Lu <lulie@linux.alibaba.com>
Link: https://patch.msgid.link/20250110010810.107145-1-lulie@linux.alibaba.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ Backport from v6.13 ]
Suggested-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
2025-07-22 21:05:55 +08:00
..
bpfilter net: Use umd_cleanup_helper() 2023-05-31 13:06:57 +02:00
netfilter netfilter: fib: check correct rtable in vrf setups 2024-12-10 20:42:48 +08:00
Kconfig tcp: configurable source port perturb table size 2022-11-16 13:02:04 +00:00
Makefile bpf,fou: Add bpf_skb_{set,get}_fou_encap kfuncs 2023-04-12 16:40:39 -07:00
af_inet.c net: inet: do not leave a dangling sk pointer in inet_create() 2024-12-16 00:22:41 +08:00
ah4.c net: ipv4: Remove completion function scaffolding 2023-02-13 18:35:15 +08:00
arp.c arp: switch to dev_getbyhwaddr() in arp_req_set_public() 2025-03-14 17:42:52 +08:00
bpf_tcp_ca.c bpf: Drop useless btf_vmlinux in bpf_tcp_ca 2023-07-18 17:31:10 -07:00
cipso_ipv4.c net: use unrcu_pointer() helper 2024-12-10 20:44:40 +08:00
datagram.c udp: fix l4 hash after reconnect 2025-07-22 21:05:55 +08:00
devinet.c ipv4: use RCU protection in inet_select_addr() 2025-03-01 15:55:12 +08:00
esp4.c espintcp: remove encap socket caching to avoid reference leak 2025-06-10 16:18:01 +08:00
esp4_offload.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-06-22 18:40:38 -07:00
fib_frontend.c ipv4: fib: Move fib_valid_key_len() to rtm_to_fib_config(). 2025-06-10 10:34:58 +08:00
fib_lookup.h
fib_notifier.c
fib_rules.c ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure(). 2025-06-10 16:17:57 +08:00
fib_semantics.c net: remove NULL-pointer net parameter in ip_metrics_convert 2024-12-10 20:41:13 +08:00
fib_trie.c ipv4: fib: Move fib_valid_key_len() to rtm_to_fib_config(). 2025-06-10 10:34:58 +08:00
fou_bpf.c bpf,fou: Add bpf_skb_{set,get}_fou_encap kfuncs 2023-04-12 16:40:39 -07:00
fou_core.c fou: fix initialization of grc 2024-12-10 20:41:35 +08:00
fou_nl.c net: ynl: prefix uAPI header include with uapi/ 2023-05-26 10:30:14 +01:00
fou_nl.h net: ynl: prefix uAPI header include with uapi/ 2023-05-26 10:30:14 +01:00
gre_demux.c
gre_offload.c net: move gso declarations and functions to their own files 2023-06-10 00:11:41 -07:00
icmp.c ipv4: Convert ip_route_input() to dscp_t. 2025-03-17 20:08:50 +08:00
igmp.c ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet 2023-12-08 08:52:21 +01:00
inet_connection_sock.c tcp: Fix bind() regression for v6-only wildcard and v4-mapped-v6 non-wildcard addresses. 2025-07-14 14:11:44 +08:00
inet_diag.c tcp: Link sk and twsk to tb2->owners using skc_bind_node. 2025-07-14 14:11:44 +08:00
inet_fragment.c net: Rename mono_delivery_time to tstamp_type for scalabilty 2025-05-09 23:16:41 +08:00
inet_hashtables.c tcp: use RCU lookup in __inet_hash_connect() 2025-07-14 14:11:44 +08:00
inet_timewait_sock.c tcp: add RCU management to inet_bind_bucket 2025-07-14 14:11:44 +08:00
inetpeer.c inetpeer: do not get a refcount in inet_getpeer() 2025-02-10 01:59:56 +08:00
ip_forward.c net: ipv4, ipv6: fix IPSTATS_MIB_OUTOCTETS increment duplicated 2023-08-30 09:44:09 +01:00
ip_fragment.c net: Rename mono_delivery_time to tstamp_type for scalabilty 2025-05-09 23:16:41 +08:00
ip_gre.c ipv4: ip_gre: Fix set but not used warning in ipgre_err() if IPv4-only 2025-06-10 16:17:58 +08:00
ip_input.c ipv4: ignore dst hint for multipath routes 2023-09-01 08:11:51 +01:00
ip_options.c ipv4: Convert ip_route_input() to dscp_t. 2025-03-17 20:08:50 +08:00
ip_output.c net: Rename mono_delivery_time to tstamp_type for scalabilty 2025-05-09 23:16:41 +08:00
ip_sockglue.c ipmr: fix kernel panic when forwarding mcast packets 2024-02-05 20:14:35 +00:00
ip_tunnel.c ipv4: ip_tunnel: Fix suspicious RCU usage warning in ip_tunnel_find() 2025-02-05 15:10:32 +08:00
ip_tunnel_core.c net: fix geneve_opt length integer overflow 2025-04-14 15:51:10 +08:00
ip_vti.c ip_vti: fix potential slab-use-after-free in decode_session6 2023-07-11 11:06:08 +02:00
ipcomp.c xfrm: ipcomp: add extack to ipcomp{4,6}_init_state 2022-09-29 07:18:00 +02:00
ipconfig.c net: ipconfig: move ic_nameservers_fallback into #ifdef block 2023-05-22 11:17:55 +01:00
ipip.c ipip,ip_tunnel,sit: Add FOU support for externally controlled ipip devices 2023-04-12 16:40:39 -07:00
ipmr.c inet: ipmr: fix data-races 2025-02-10 01:59:56 +08:00
ipmr_base.c ipmr: do not call mr_mfc_uses_dev() for unres entries 2025-02-10 01:59:56 +08:00
metrics.c net: remove NULL-pointer net parameter in ip_metrics_convert 2024-12-10 20:41:13 +08:00
netfilter.c
netlink.c
nexthop.c net: nexthop: Initialize all fields in dumped nexthops 2024-12-10 20:40:07 +08:00
ping.c bpf: Propagate modified uaddrlen from cgroup sockaddr programs 2024-01-31 16:19:04 -08:00
proc.c net: fix IPSTATS_MIB_OUTPKGS increment in OutForwDatagrams. 2024-04-03 15:28:39 +02:00
protocol.c
raw.c ipv4: Fix uninit-value access in __ip_make_skb() 2024-12-10 20:19:42 +08:00
raw_diag.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-04-06 12:01:20 -07:00
route.c ipv4/route: Use this_cpu_inc() for stats on PREEMPT_RT 2025-07-03 11:32:02 +08:00
syncookies.c tcp: annotate data-races around tp->window_clamp 2024-12-10 20:40:12 +08:00
sysctl_net_ipv4.c networking: Update to register_net_sysctl_sz 2023-08-15 15:26:18 -07:00
tcp.c tcp: Correct signedness in skb remaining space calculation 2025-07-22 16:16:38 +08:00
tcp_bbr.c bpf: Add __bpf_kfunc tag to all kfuncs 2023-02-02 00:25:14 +01:00
tcp_bic.c
tcp_bpf.c bpf: Fix wrong copied_seq calculation 2025-03-14 17:42:52 +08:00
tcp_cdg.c Random number generator fixes for Linux 6.1-rc1. 2022-10-16 15:27:07 -07:00
tcp_cong.c net: remove NULL-pointer net parameter in ip_metrics_convert 2024-12-10 20:41:13 +08:00
tcp_cubic.c tcp_cubic: fix incorrect HyStart round start detection 2025-02-10 01:59:56 +08:00
tcp_dctcp.c tcp: Fix shift-out-of-bounds in dctcp_update_alpha(). 2024-12-10 20:26:18 +08:00
tcp_dctcp.h
tcp_diag.c tcp: Access &tcp_hashinfo via net. 2022-09-20 10:21:49 -07:00
tcp_fastopen.c tcp: fix passive TFO socket having invalid NAPI ID 2025-07-03 11:32:10 +08:00
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_illinois.c
tcp_input.c tcp: cache RTAX_QUICKACK metric in a hot cache line 2025-07-14 14:11:44 +08:00
tcp_ipv4.c tcp: drop secpath at the same time as we currently drop dst 2025-03-14 17:42:52 +08:00
tcp_lp.c
tcp_metrics.c tcp_metrics: optimize tcp_metrics_flush_all() 2024-12-10 20:40:33 +08:00
tcp_minisocks.c tcp: Defer ts_recent changes until req is owned 2025-03-17 20:08:50 +08:00
tcp_nv.c
tcp_offload.c net-timestamp: support TCP GSO case for a few missing flags 2025-03-18 15:20:51 +08:00
tcp_output.c net: Rename mono_delivery_time to tstamp_type for scalabilty 2025-05-09 23:16:41 +08:00
tcp_plb.c prandom: remove prandom_u32_max() 2022-12-20 03:13:45 +01:00
tcp_rate.c
tcp_recovery.c tcp: fix excessive TLP and RACK timeouts from HZ rounding 2023-10-17 17:25:42 -07:00
tcp_scalable.c
tcp_timer.c tcp: record last received ipv6 flowlabel 2025-07-02 15:46:51 +08:00
tcp_ulp.c net/ulp: use consistent error code when blocking ULP 2023-01-19 09:26:16 -08:00
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c
tcp_yeah.c
tunnel4.c
udp.c udp: Make rehash4 independent in udp_lib_rehash() 2025-07-22 21:05:55 +08:00
udp_bpf.c bpf, sockmap: Fix an infinite loop error when len is 0 in tcp_bpf_recvmsg_parser() 2023-03-03 17:25:15 +01:00
udp_diag.c udp: Access &udp_table via net. 2022-11-16 09:43:35 +00:00
udp_impl.h sock: Remove ->sendpage*() in favour of sendmsg(MSG_SPLICE_PAGES) 2023-06-24 15:50:13 -07:00
udp_offload.c net: fix udp gso skb_segment after pull from frag_list 2025-06-20 14:40:12 +08:00
udp_tunnel_core.c udp: lockless UDP_ENCAP_L2TPINUDP / UDP_GRO 2023-11-20 11:58:56 +01:00
udp_tunnel_nic.c udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write() 2022-11-29 08:44:24 -08:00
udp_tunnel_stub.c
udplite.c udplite: remove UDPLITE_BIT 2023-11-20 11:58:56 +01:00
xfrm4_input.c xfrm: Preserve vlan tags for transport mode software GRO 2024-12-10 20:19:47 +08:00
xfrm4_output.c
xfrm4_policy.c xfrm: respect ip protocols rules criteria when performing dst lookups 2024-12-10 20:43:09 +08:00
xfrm4_protocol.c net: xfrm: unexport __init-annotated xfrm4_protocol_init() 2022-06-08 10:10:13 -07:00
xfrm4_state.c
xfrm4_tunnel.c xfrm: tunnel: add extack to ipip_init_state, xfrm6_tunnel_init_state 2022-09-29 07:18:00 +02:00