Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] IB/iser: Fix deadlock during blocking connect
@ 2026-11-23 14:44 Ziyu Zhang
  2026-11-23 15:02 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Ziyu Zhang @ 2026-11-23 14:44 UTC (permalink / raw)
  To: sagi, mgurtovoy, jgg, leon
  Cc: linux-rdma, linux-kernel, baijiaju1990, ziyuzhang201

iser_connect() holds state_mutex while waiting for up_completion. The
CMA handler for the same connection needs state_mutex before it can call
iser_connected_handler() and complete up_completion. A blocking connect
can therefore prevent its own connection completion and leave the waiter
blocked until a signal arrives.

Drop state_mutex around the wait and reacquire it before checking the
connection state, preserving serialization of state and cleanup paths.

Fixes: 504130c039f9 ("IB/iser: Protect iser state machine with a mutex")
Cc: stable@vger.kernel.org
Signed-off-by: Ziyu Zhang <ziyuzhang201@gmail.com>
---
 drivers/infiniband/ulp/iser/iser_verbs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 55fe68e..9fe2d3f 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -778,7 +778,9 @@ int iser_connect(struct iser_conn *iser_conn, struct sockaddr *src_addr,
 	}
 
 	if (!non_blocking) {
+		mutex_unlock(&iser_conn->state_mutex);
 		wait_for_completion_interruptible(&iser_conn->up_completion);
+		mutex_lock(&iser_conn->state_mutex);
 
 		if (iser_conn->state != ISER_CONN_UP) {
 			err =  -EIO;
-- 
2.34.1


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

end of thread, other threads:[~2026-11-23 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 14:44 [PATCH] IB/iser: Fix deadlock during blocking connect Ziyu Zhang
2026-11-23 15:02 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox