From 72208a0d7d613d83a660604904a78ce68494acdc Mon Sep 17 00:00:00 2001 From: Serguei Smirnov Date: Thu, 30 May 2024 11:14:09 -0700 Subject: [PATCH] LU-17743 o2iblnd: fix privileged port check in passive_connect Check that the port is in "privileged" range only if kib_require_priv_port is set Test-Parameters: trivial testlist=sanity-lnet Fixes: 9b18afa ("LU-17743 ko2iblnd: move to struct lnet_nid") Signed-off-by: Serguei Smirnov Change-Id: I3ed9c174d983be68aecc4b8e12aaae7c096d26e8 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55266 Reviewed-by: James Simmons Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- lnet/klnds/o2iblnd/o2iblnd_cb.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c index b05eb12..95d48f7 100644 --- a/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -2582,11 +2582,12 @@ kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob) default: break; } - } - if (port >= PROT_SOCK) { - CERROR("peer_ni's port (%pISc:%hu) is not privileged\n", - &cmid->route.addr.dst_addr, port); - goto failed; + + if (port >= PROT_SOCK) { + CERROR("peer_ni's port (%pISc:%hu) is not privileged\n", + &cmid->route.addr.dst_addr, port); + goto failed; + } } if (priv_nob < offsetof(struct kib_msg, ibm_type)) { -- 1.8.3.1