[PATCH 2/2] smb: smbdirect: don't use the iWarp port mapper
From: Stefan Metzmacher
Date: Tue Dec 01 2026 - 11:27:46 EST
smbdirect uses the well known port 5445 for iWarp. If iwpmd is
running, the listener is mapped to another port and a client asks
the remote iwpmd for the mapped port of the remote listener, which
only works if the state of both sides matches. E.g. a listener
created before iwpmd was started is not mapped, but the remote
iwpmd still hands out a mapped port, so the connection goes to a
port nobody listens on.
Use rdma_set_iwpm(false), so iWarp devices always listen on and
connect to the requested ports.
Fixes: dce268ffcddc ("smb: smbdirect: introduce smbdirect_socket_init_{new,accepting}() and helpers")
Cc: stable@xxxxxxxxxxxxxxx
Cc: Namjae Jeon <linkinjeon@xxxxxxxxxx>
Cc: Paulo Alcantara <pc@xxxxxxxxxxxxx>
Cc: Tom Talpey <tom@xxxxxxxxxx>
Cc: Jason Gunthorpe <jgg@xxxxxxxx>
Cc: Leon Romanovsky <leon@xxxxxxxxxx>
Cc: linux-cifs@xxxxxxxxxxxxxxx
Cc: samba-technical@xxxxxxxxxxxxxxx
Cc: linux-rdma@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Stefan Metzmacher <metze@xxxxxxxxx>
---
fs/smb/smbdirect/socket.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/fs/smb/smbdirect/socket.c b/fs/smb/smbdirect/socket.c
index 13cf50b96bc9..837883192857 100644
--- a/fs/smb/smbdirect/socket.c
+++ b/fs/smb/smbdirect/socket.c
@@ -76,6 +76,18 @@ int smbdirect_socket_init_new(struct net *net, struct smbdirect_socket *sc)
return ret;
}
+ /*
+ * Never use the iWarp port mapper (iwpmd), so an iWarp device
+ * listens on and connects to the ports we ask for, e.g. 5445.
+ */
+ ret = rdma_set_iwpm(id, false);
+ if (ret) {
+ rdma_destroy_id(id);
+ pr_err("%s: rdma_set_iwpm() failed %1pe\n",
+ __func__, SMBDIRECT_DEBUG_ERR_PTR(ret));
+ return ret;
+ }
+
sc->rdma.cm_id = id;
INIT_WORK(&sc->disconnect_work, smbdirect_socket_cleanup_work);
--
2.43.0