Matthieu Baerts (NGI0)
cb8b81ad3e
mptcp: init: protect sched with rcu_read_lock
[ Upstream commit 3deb12c788 ]
Enabling CONFIG_PROVE_RCU_LIST with its dependence CONFIG_RCU_EXPERT
creates this splat when an MPTCP socket is created:
=============================
WARNING: suspicious RCU usage
6.12.0-rc2+ #11 Not tainted
-----------------------------
net/mptcp/sched.c:44 RCU-list traversed in non-reader section!!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
no locks held by mptcp_connect/176.
stack backtrace:
CPU: 0 UID: 0 PID: 176 Comm: mptcp_connect Not tainted 6.12.0-rc2+ #11
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Call Trace:
<TASK>
dump_stack_lvl (lib/dump_stack.c:123)
lockdep_rcu_suspicious (kernel/locking/lockdep.c:6822)
mptcp_sched_find (net/mptcp/sched.c:44 (discriminator 7))
mptcp_init_sock (net/mptcp/protocol.c:2867 (discriminator 1))
? sock_init_data_uid (arch/x86/include/asm/atomic.h:28)
inet_create.part.0.constprop.0 (net/ipv4/af_inet.c:386)
? __sock_create (include/linux/rcupdate.h:347 (discriminator 1))
__sock_create (net/socket.c:1576)
__sys_socket (net/socket.c:1671)
? __pfx___sys_socket (net/socket.c:1712)
? do_user_addr_fault (arch/x86/mm/fault.c:1419 (discriminator 1))
__x64_sys_socket (net/socket.c:1728)
do_syscall_64 (arch/x86/entry/common.c:52 (discriminator 1))
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
That's because when the socket is initialised, rcu_read_lock() is not
used despite the explicit comment written above the declaration of
mptcp_sched_find() in sched.c. Adding the missing lock/unlock avoids the
warning.
Fixes: 1730b2b2c5 ("mptcp: add sched in mptcp_sock")
Cc: stable@vger.kernel.org
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/523
Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241021-net-mptcp-sched-lock-v1-1-637759cf061c@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-08 16:28:25 +01:00
..
2024-06-16 13:47:41 +02:00
2024-05-17 12:02:07 +02:00
2023-12-20 17:01:50 +01:00
2023-12-20 17:01:48 +01:00
2024-06-21 14:38:14 +02:00
2024-07-05 09:34:04 +02:00
2024-11-08 16:28:19 +01:00
2024-11-08 16:28:19 +01:00
2023-05-31 13:06:57 +02:00
2024-10-17 15:24:29 +02:00
2023-06-24 15:50:13 -07:00
2024-10-04 16:28:58 +02:00
2024-10-17 15:24:10 +02:00
2024-11-08 16:28:19 +01:00
2023-08-01 21:07:46 -07:00
2024-08-29 17:33:46 +02:00
2024-03-26 18:20:11 -04:00
2024-01-25 15:35:41 -08:00
2024-10-10 11:58:07 +02:00
2024-05-02 16:32:46 +02:00
2024-09-04 13:28:26 +02:00
2024-02-23 09:24:50 +01:00
2024-05-17 12:02:24 +02:00
2023-08-29 17:39:15 -07:00
2024-01-01 12:42:30 +00:00
2024-11-01 01:58:28 +01:00
2024-11-08 16:28:19 +01:00
2024-08-29 17:33:39 +02:00
2024-08-29 17:33:46 +02:00
2023-08-18 12:44:56 -07:00
2024-11-01 01:58:23 +01:00
2024-02-05 20:14:36 +00:00
2024-11-08 16:28:23 +01:00
2024-10-10 11:57:59 +02:00
2024-10-17 15:24:29 +02:00
2024-10-17 15:24:30 +02:00
2024-11-08 16:28:25 +01:00
2024-06-21 14:38:14 +02:00
2024-11-08 16:28:19 +01:00
2024-01-25 15:35:14 -08:00
2024-11-01 01:58:23 +01:00
2024-06-27 13:49:06 +02:00
2024-08-19 06:04:28 +02:00
2024-05-17 12:02:02 +02:00
2024-08-29 17:33:50 +02:00
2024-08-03 08:54:13 +02:00
2024-10-17 15:24:30 +02:00
2023-12-13 18:45:10 +01:00
2024-10-04 16:29:41 +02:00
2024-08-19 06:04:27 +02:00
2024-01-01 12:42:41 +00:00
2024-01-01 12:42:31 +00:00
2024-10-17 15:24:24 +02:00
2024-11-08 16:28:18 +01:00
2024-10-17 15:24:28 +02:00
2024-11-01 01:58:22 +01:00
2024-08-19 06:04:23 +02:00
2024-03-01 13:35:06 +01:00
2024-10-10 11:57:25 +02:00
2024-06-12 11:12:50 +02:00
2024-09-12 11:11:29 +02:00
2024-11-01 01:58:25 +01:00
2024-11-08 16:28:23 +01:00
2024-03-26 18:19:41 -04:00
2024-04-17 11:19:28 +02:00
2024-11-01 01:58:34 +01:00
2023-07-19 10:07:27 -07:00
2024-10-17 15:24:35 +02:00
2024-08-11 12:47:13 +02:00