linux-yocto/net
Zhang Tengfei 54f4da8629 ipvs: Use READ_ONCE/WRITE_ONCE for ipvs->enable
[ Upstream commit 944b6b216c0387ac3050cd8b773819ae360bfb1c ]

KCSAN reported a data-race on the `ipvs->enable` flag, which is
written in the control path and read concurrently from many other
contexts.

Following a suggestion by Julian, this patch fixes the race by
converting all accesses to use `WRITE_ONCE()/READ_ONCE()`.
This lightweight approach ensures atomic access and acts as a
compiler barrier, preventing unsafe optimizations where the flag
is checked in loops (e.g., in ip_vs_est.c).

Additionally, the `enable` checks in the fast-path hooks
(`ip_vs_in_hook`, `ip_vs_out_hook`, `ip_vs_forward_icmp`) are
removed. These are unnecessary since commit 857ca89711
("ipvs: register hooks only with services"). The `enable=0`
condition they check for can only occur in two rare and non-fatal
scenarios: 1) after hooks are registered but before the flag is set,
and 2) after hooks are unregistered on cleanup_net. In the worst
case, a single packet might be mishandled (e.g., dropped), which
does not lead to a system crash or data corruption. Adding a check
in the performance-critical fast-path to handle this harmless
condition is not a worthwhile trade-off.

Fixes: 857ca89711 ("ipvs: register hooks only with services")
Reported-by: syzbot+1651b5234028c294c339@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1651b5234028c294c339
Suggested-by: Julian Anastasov <ja@ssi.bg>
Link: https://lore.kernel.org/lvs-devel/2189fc62-e51e-78c9-d1de-d35b8e3657e3@ssi.bg/
Signed-off-by: Zhang Tengfei <zhtfdev@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-10-15 11:58:00 +02:00
..
6lowpan
9p net/9p: fix double req put in p9_fd_cancelled 2025-10-12 12:56:23 +02:00
802
8021q net: vlan: fix VLAN 0 refcount imbalance of toggling filtering during runtime 2025-07-24 08:53:19 +02:00
appletalk net: appletalk: Fix use-after-free in AARP proxy probe 2025-08-01 09:47:29 +01:00
atm net: atm: fix memory leak in atm_register_sysfs when device_register fail 2025-09-09 18:56:25 +02:00
ax25 ax25: properly unshare skbs in ax25_kiss_rcv() 2025-09-09 18:56:25 +02:00
batman-adv batman-adv: fix OOB read/write in network-coding decode 2025-09-09 18:56:27 +02:00
bluetooth Bluetooth: hci_event: Fix UAF in hci_acl_create_conn_sync 2025-10-02 13:42:51 +02:00
bpf
bpfilter
bridge net: bridge: Bounce invalid boolopts 2025-09-19 16:32:06 +02:00
caif caif: reduce stack size, again 2025-08-15 12:08:45 +02:00
can can: j1939: j1939_local_ecu_get(): undo increment when j1939_local_ecu_get() fails 2025-09-19 16:32:06 +02:00
ceph libceph: fix invalid accesses to ceph_connection_v1_info 2025-09-19 16:32:04 +02:00
core bpf: Explicitly check accesses to bpf_sock_addr 2025-10-15 11:57:53 +02:00
dcb
dccp
devlink
dns_resolver
dsa net: dsa: microchip: linearize skb for tail-tagging switches 2025-09-09 18:56:31 +02:00
ethernet
ethtool net: ethtool: Don't call .cleanup_data when prepare_data fails 2025-04-25 10:45:07 +02:00
handshake
hsr hsr: use hsr_for_each_port_rtnl in hsr_port_get_hsr 2025-09-19 16:32:06 +02:00
ieee802154 net: Rename mono_delivery_time to tstamp_type for scalabilty 2025-05-09 09:43:57 +02:00
ife
ipv4 tcp: fix __tcp_close() to only send RST when required 2025-10-15 11:57:58 +02:00
ipv6 minmax: add a few more MIN_T/MAX_T users 2025-09-25 11:00:10 +02:00
iucv
kcm
key
l2tp
l3mdev
lapb
llc llc: fix data loss when reading from a socket in llc_ui_recvmsg() 2025-06-04 14:42:20 +02:00
mac80211 wifi: mac80211: fix incorrect type for ret 2025-09-25 11:00:05 +02:00
mac802154
mctp mctp: return -ENOPROTOOPT for unknown getsockopt options 2025-09-09 18:56:24 +02:00
mpls mpls: Use rcu_dereference_rtnl() in mpls_route_input_rcu(). 2025-06-27 11:09:02 +01:00
mptcp mptcp: propagate shutdown to subflows when possible 2025-09-25 11:00:10 +02:00
ncsi net: ncsi: Fix buffer overflow in fetching version id 2025-08-28 16:28:24 +02:00
netfilter ipvs: Use READ_ONCE/WRITE_ONCE for ipvs->enable 2025-10-15 11:58:00 +02:00
netlabel calipso: unlock rcu before returning -EAFNOSUPPORT 2025-06-19 15:28:46 +02:00
netlink netlink: add variable-length / auto integers 2025-09-09 18:56:22 +02:00
netrom
nfc NFC: nci: uart: Set tty->disc_data only in success path 2025-06-27 11:08:48 +01:00
nsh
openvswitch net: openvswitch: Fix the dead loop of MPLS parse 2025-06-19 15:28:19 +02:00
packet net/packet: fix a race in packet_set_ring() and packet_notifier() 2025-08-15 12:09:05 +02:00
phonet phonet/pep: Move call to pn_skb_get_dst_sockaddr() earlier in pep_sock_accept() 2025-07-24 08:53:12 +02:00
psample
qrtr
rds rds: ib: Increment i_fastreg_wrs before bailing out 2025-09-25 11:00:08 +02:00
rfkill net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer 2025-09-25 11:00:08 +02:00
rose net: rose: fix a typo in rose_clear_routes() 2025-09-04 15:30:28 +02:00
rxrpc rxrpc: Fix transmission of an abort in response to an abort 2025-07-24 08:53:20 +02:00
sched net/sched: Remove unnecessary WARNING condition for empty child qdisc in htb_activate 2025-08-28 16:28:49 +02:00
sctp sctp: initialize more fields in sctp_v6_from_sk() 2025-09-04 15:30:26 +02:00
smc net/smc: Remove validation of reserved bits in CLC Decline message 2025-09-09 18:56:24 +02:00
strparser
sunrpc Revert "SUNRPC: Don't allow waiting for exiting tasks" 2025-09-19 16:32:03 +02:00
switchdev
tipc tipc: Fix use-after-free in tipc_conn_close(). 2025-07-17 18:35:09 +02:00
tls tls: make sure to abort the stream if headers are bogus 2025-09-25 11:00:06 +02:00
unix af_unix: Don't set -ECONNRESET for consumed OOB skb. 2025-07-06 11:00:12 +02:00
vmw_vsock vsock/virtio: Validate length in packet header before skb_put() 2025-08-28 16:28:36 +02:00
wireless wifi: cfg80211: sme: cap SSID length in __cfg80211_connect_result() 2025-09-09 18:56:24 +02:00
x25
xdp
xfrm xfrm: xfrm_alloc_spi shouldn't use 0 as SPI 2025-10-02 13:42:50 +02:00
compat.c
devres.c
Kconfig
Kconfig.debug
Makefile af_unix: Remove CONFIG_UNIX_SCM. 2025-06-04 14:42:22 +02:00
socket.c
sysctl_net.c