[lustre-devel] [PATCH 37/39] lnet: use an unbound cred in kiblnd_resolve_addr()
James Simmons
jsimmons at infradead.org
Thu Jan 21 09:17:00 PST 2021
From: "John L. Hammond" <jhammond at whamcloud.com>
In kiblnd_resolve_addr() call prepare_kernel_cred(NULL) rather than
prepare_creds() to get a cred with unbound capabilities.
Fixes: 5fc342b471a ("lnet: o2ib: raise bind cap before resolving address")
WC-bug-id: https://jira.whamcloud.com/browse/LU-14296
Lustre-commit: 30b356a28b5094 ("LU-14296 lnet: use an unbound cred in kiblnd_resolve_addr()")
Signed-off-by: John L. Hammond <jhammond at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41137
Reviewed-by: Amir Shehata <ashehata at whamcloud.com>
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
net/lnet/klnds/o2iblnd/o2iblnd_cb.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/net/lnet/klnds/o2iblnd/o2iblnd_cb.c b/net/lnet/klnds/o2iblnd/o2iblnd_cb.c
index c799453..e29cb4b 100644
--- a/net/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/net/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -1207,8 +1207,6 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
unsigned short port;
int rc;
- LASSERT(capable(CAP_NET_BIND_SERVICE));
-
/* allow the port to be reused */
rc = rdma_set_reuseaddr(cmid, 1);
if (rc) {
@@ -1234,7 +1232,8 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
}
}
- CERROR("Failed to bind to a free privileged port\n");
+ CERROR("cannot bind to a free privileged port: rc = %d\n", rc);
+
return rc;
}
@@ -1249,7 +1248,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
int rc;
if (!capable(CAP_NET_BIND_SERVICE)) {
- new_creds = prepare_creds();
+ new_creds = prepare_kernel_cred(NULL);
if (!new_creds)
return -ENOMEM;
--
1.8.3.1
More information about the lustre-devel
mailing list