Skip to contentSkip to conversation

rds: ib: use rds_conn_drop() on protocol version mismatch

PATCH Applied Aohan Mei 3 participants 3 messages Sep 11 – Sep 15

Subsystems (5)
lore
Share & tools
lore

Aohan Mei

author
#0 lore raw

PATCH v2 1/1 rds: ib: use rds_conn_drop() on protocol version mismatch

From: Aohan Mei <[email protected]>

rds_ib_cm_connect_complete() runs from the RDMA-CM event handler with conn->c_cm_lock held. When the peer negotiates a protocol version older than RDS_PROTOCOL_COMPAT_VERSION, the handler calls rds_conn_destroy(), which is only safe in the rmmod path: it synchronously tears the connection down and flush_work()es the shutdown work cp_down_w.

That shutdown work (rds_conn_shutdown()) needs cp_cm_lock, which is the very lock the event handler still holds, so the flush never
completes: the two workers wait on each other and the RDS connection workqueues stall for good.

All other RDMA-CM failure paths (REJECTED, CONNECT_ERROR, DISCONNECTED) use rds_conn_drop(), which marks the connection RDS_CONN_ERROR and schedules the shutdown work asynchronously. Use it here as well.

Fixes f147dd9ecabf ("RDS/IB: Disallow connections less than RDS 3.1")
Assisted-by CodeBuddy:Kimi-K3

---
v1 -> v2:
- Point Fixes at f147dd9ecabf, which introduced the rds_conn_destroy()
call in the version check, instead of the later refactor cdc306a5c9cd (Allison)
- Add Allison's Reviewed-by
- Link to v1: https://lore.kernel.org/netdev/[email protected]/

 net/rds/ib_cm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/ib_cm.c +1 -1
index d46146887ba4..2909da8363f3 100644
@@ -115,7 +115,7 @@ void rds_ib_cm_connect_complete(struct rds_connection *conn, struct rdma_cm_even
 				  &conn->c_laddr, &conn->c_faddr,
 				  RDS_PROTOCOL_MAJOR(conn->c_version),
 				  RDS_PROTOCOL_MINOR(conn->c_version));
-			rds_conn_destroy(conn);
+			rds_conn_drop(conn);
 			return;
 		}
 	}
Signature · 1 line
2.43.7
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 19 lines

From: Aohan Mei <[email protected]>

rds_ib_cm_connect_complete() runs from the RDMA-CM event handler with conn->c_cm_lock held. When the peer negotiates a protocol version older than RDS_PROTOCOL_COMPAT_VERSION, the handler calls rds_conn_destroy(), which is only safe in the rmmod path: it synchronously tears the connection down and flush_work()es the shutdown work cp_down_w.

That shutdown work (rds_conn_shutdown()) needs cp_cm_lock, which is the very lock the event handler still holds, so the flush never
completes: the two workers wait on each other and the RDS connection workqueues stall for good.

All other RDMA-CM failure paths (REJECTED, CONNECT_ERROR, DISCONNECTED) use rds_conn_drop(), which marks the connection RDS_CONN_ERROR and schedules the shutdown work asynchronously. Use it here as well.

Quoted 6 lines
Fixes f147dd9ecabf ("RDS/IB: Disallow connections less than RDS 3.1")
Assisted-by CodeBuddy:Kimi-K3

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Aohan Mei
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Fri, 11 Sep 2026 15:34:32 +0800 you wrote:

From: Aohan Mei <[email protected]>

rds_ib_cm_connect_complete() runs from the RDMA-CM event handler with conn->c_cm_lock held. When the peer negotiates a protocol version older than RDS_PROTOCOL_COMPAT_VERSION, the handler calls rds_conn_destroy(), which is only safe in the rmmod path: it synchronously tears the connection down and flush_work()es the shutdown work cp_down_w.

[...]

Here is the summary with links:
- [net,v2] rds: ib: use rds_conn_drop() on protocol version mismatch

    https://git.kernel.org/netdev/net/c/f97d8c7bab78

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html