Patch "mptcp: init: protect sched with rcu_read_lock" has been added to the 6.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mptcp: init: protect sched with rcu_read_lock

to the 6.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mptcp-init-protect-sched-with-rcu_read_lock.patch
and it can be found in the queue-6.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5ff8dc7ec233f1cad08d9df82748819a7e9a0b6f
Author: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
Date:   Mon Oct 21 12:25:26 2024 +0200

    mptcp: init: protect sched with rcu_read_lock
    
    [ Upstream commit 3deb12c788c385e17142ce6ec50f769852fcec65 ]
    
    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: 1730b2b2c5a5 ("mptcp: add sched in mptcp_sock")
    Cc: stable@xxxxxxxxxxxxxxx
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/523
    Reviewed-by: Geliang Tang <geliang@xxxxxxxxxx>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
    Reviewed-by: Simon Horman <horms@xxxxxxxxxx>
    Link: https://patch.msgid.link/20241021-net-mptcp-sched-lock-v1-1-637759cf061c@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index d4b3bc46cdaaf..ec87b36f0d451 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2864,8 +2864,10 @@ static int mptcp_init_sock(struct sock *sk)
 	if (unlikely(!net->mib.mptcp_statistics) && !mptcp_mib_alloc(net))
 		return -ENOMEM;
 
+	rcu_read_lock();
 	ret = mptcp_init_sched(mptcp_sk(sk),
 			       mptcp_sched_find(mptcp_get_scheduler(net)));
+	rcu_read_unlock();
 	if (ret)
 		return ret;
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux