All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] mptcp: fix deadlock in mptcp_close()
@ 2022-05-05 11:03 Dan Carpenter
  2022-05-05 11:50 ` Paolo Abeni
  2022-05-05 12:34 ` mptcp: fix deadlock in mptcp_close(): Tests Results MPTCP CI
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-05-05 11:03 UTC (permalink / raw)
  To: Mat Martineau, Geliang Tang
  Cc: Matthieu Baerts, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, mptcp, kernel-janitors

The mptcp_data_lock/unlock(sk) functions are taking the same spin lock
as the lock_sock()/release_sock() functions.  So we're already holding
the lock at this point and taking it again will lead to a deadlock.

Fixes: 4293248c6704 ("mptcp: add data lock for sk timers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
From static analysis.  Not tested.

 net/mptcp/protocol.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index a5d466e6b538..eef4673dae3a 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2872,9 +2872,7 @@ static void mptcp_close(struct sock *sk, long timeout)
 		__mptcp_destroy_sock(sk);
 		do_cancel_work = true;
 	} else {
-		mptcp_data_lock(sk);
 		sk_reset_timer(sk, &sk->sk_timer, jiffies + TCP_TIMEWAIT_LEN);
-		mptcp_data_unlock(sk);
 	}
 	release_sock(sk);
 	if (do_cancel_work)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-05 12:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-05 11:03 [PATCH net-next] mptcp: fix deadlock in mptcp_close() Dan Carpenter
2022-05-05 11:50 ` Paolo Abeni
2022-05-05 12:23   ` Dan Carpenter
2022-05-05 12:34 ` mptcp: fix deadlock in mptcp_close(): Tests Results MPTCP CI

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.