All of
 help / color / mirror / Atom feed
From: Mat Martineau <>
Cc: Maxim Galaganov <>,,,,,, Mat Martineau <>
Subject: [PATCH net 3/4] mptcp: fix deadlock in __mptcp_push_pending()
Date: Tue, 14 Dec 2021 15:16:03 -0800	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Maxim Galaganov <>

__mptcp_push_pending() may call mptcp_flush_join_list() with subflow
socket lock held. If such call hits mptcp_sockopt_sync_all() then
subsequently __mptcp_sockopt_sync() could try to lock the subflow
socket for itself, causing a deadlock.

sysrq: Show Blocked State
task:ss-server       state:D stack:    0 pid:  938 ppid:     1 flags:0x00000000
Call Trace:
 ? __mod_memcg_state+0x4d/0x70
 ? csum_partial+0xd/0x20
 ? _raw_spin_lock_irqsave+0x26/0x50
 ? do_wait_intr_irq+0xa0/0xa0
 ? do_wait_intr_irq+0xa0/0xa0
 ? fpregs_restore_userregs+0x12/0xd0
RIP: 0033:0x7f9ba546c2d0
RSP: 002b:00007ffdc3b762d8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f9ba56c8060 RCX: 00007f9ba546c2d0
RDX: 000000000000077a RSI: 0000000000e5e180 RDI: 0000000000000234
RBP: 0000000000cc57f0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9ba56c8060
R13: 0000000000b6ba60 R14: 0000000000cc7840 R15: 41d8685b1d7901b8

Fix the issue by using __mptcp_flush_join_list() instead of plain
mptcp_flush_join_list() inside __mptcp_push_pending(), as suggested by
Florian. The sockopt sync will be deferred to the workqueue.

Fixes: 1b3e7ede1365 ("mptcp: setsockopt: handle SO_KEEPALIVE and SO_PRIORITY")
Suggested-by: Florian Westphal <>
Reviewed-by: Florian Westphal <>
Signed-off-by: Maxim Galaganov <>
Signed-off-by: Mat Martineau <>
 net/mptcp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 6dc1ff07994c..54613f5b7521 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1524,7 +1524,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 			int ret = 0;
 			prev_ssk = ssk;
-			mptcp_flush_join_list(msk);
+			__mptcp_flush_join_list(msk);
 			ssk = mptcp_subflow_get_send(msk);
 			/* First check. If the ssk has changed since

  parent reply	other threads:[~2021-12-14 23:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14 23:16 [PATCH net 0/4] mptcp: Fixes for ULP, a deadlock, and netlink docs Mat Martineau
2021-12-14 23:16 ` [PATCH net 1/4] mptcp: remove tcp ulp setsockopt support Mat Martineau
2021-12-14 23:16 ` [PATCH net 2/4] mptcp: clear 'kern' flag from fallback sockets Mat Martineau
2021-12-14 23:16 ` Mat Martineau [this message]
2021-12-14 23:16 ` [PATCH net 4/4] mptcp: add missing documented NL params Mat Martineau
2021-12-15  4:40 ` [PATCH net 0/4] mptcp: Fixes for ULP, a deadlock, and netlink docs patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.