linux/net/netfilter/ipvs
Fedor Pchelkin d6938c1c76 ipvs: avoid stat macros calls from preemptible context
Inside decrement_ttl() upon discovering that the packet ttl has exceeded,
__IP_INC_STATS and __IP6_INC_STATS macros can be called from preemptible
context having the following backtrace:

check_preemption_disabled: 48 callbacks suppressed
BUG: using __this_cpu_add() in preemptible [00000000] code: curl/1177
caller is decrement_ttl+0x217/0x830
CPU: 5 PID: 1177 Comm: curl Not tainted 6.7.0+ #34
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xbd/0xe0
 check_preemption_disabled+0xd1/0xe0
 decrement_ttl+0x217/0x830
 __ip_vs_get_out_rt+0x4e0/0x1ef0
 ip_vs_nat_xmit+0x205/0xcd0
 ip_vs_in_hook+0x9b1/0x26a0
 nf_hook_slow+0xc2/0x210
 nf_hook+0x1fb/0x770
 __ip_local_out+0x33b/0x640
 ip_local_out+0x2a/0x490
 __ip_queue_xmit+0x990/0x1d10
 __tcp_transmit_skb+0x288b/0x3d10
 tcp_connect+0x3466/0x5180
 tcp_v4_connect+0x1535/0x1bb0
 __inet_stream_connect+0x40d/0x1040
 inet_stream_connect+0x57/0xa0
 __sys_connect_file+0x162/0x1a0
 __sys_connect+0x137/0x160
 __x64_sys_connect+0x72/0xb0
 do_syscall_64+0x6f/0x140
 entry_SYSCALL_64_after_hwframe+0x6e/0x76
RIP: 0033:0x7fe6dbbc34e0

Use the corresponding preemption-aware variants: IP_INC_STATS and
IP6_INC_STATS.

Found by Linux Verification Center (linuxtesting.org).

Fixes: 8d8e20e2d7 ("ipvs: Decrement ttl")
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Acked-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Simon Horman <horms@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2024-01-17 12:02:51 +01:00
..
ip_vs_app.c ipvs: fix WARNING in ip_vs_app_net_cleanup() 2022-11-02 09:39:14 +01:00
ip_vs_conn.c Kill sched.h dependency on rcupdate.h 2023-12-27 11:50:20 -05:00
ip_vs_core.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_ctl.c sysctl-6.6-rc1 2023-08-29 17:39:15 -07:00
ip_vs_dh.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_est.c Kill sched.h dependency on rcupdate.h 2023-12-27 11:50:20 -05:00
ip_vs_fo.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_ftp.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_lblc.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_lblcr.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_lc.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_mh.c netfilter: ipvs: Use the bitmap API to allocate bitmaps 2022-07-21 00:55:39 +02:00
ip_vs_nfct.c netfilter: nf_conntrack_sip: fix expectation clash 2019-07-16 13:16:59 +02:00
ip_vs_nq.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_ovf.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_pe_sip.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_pe.c ipvs: don't ignore errors in case refcounting ip_vs module fails 2019-10-24 11:53:19 +02:00
ip_vs_proto_ah_esp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ip_vs_proto_sctp.c netfilter: ipvs: prefer skb_ensure_writable 2019-05-31 18:02:44 +02:00
ip_vs_proto_tcp.c ipvs: adjust the debug info in function set_tcp_state 2020-10-20 13:54:46 +02:00
ip_vs_proto_udp.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
ip_vs_proto.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ip_vs_rr.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_sched.c ipvs: don't ignore errors in case refcounting ip_vs module fails 2019-10-24 11:53:19 +02:00
ip_vs_sed.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_sh.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_sync.c ipv6: annotate data-races around np->mcast_oif 2023-12-11 10:59:17 +00:00
ip_vs_twos.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_wlc.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_wrr.c ipvs: add missing module descriptions 2023-11-08 13:52:33 +01:00
ip_vs_xmit.c ipvs: avoid stat macros calls from preemptible context 2024-01-17 12:02:51 +01:00
Kconfig ipvs: increase ip_vs_conn_tab_bits range for 64BIT 2023-06-01 21:16:38 +02:00
Makefile ipvs: add weighted random twos choice algorithm 2021-01-26 01:09:46 +01:00