Linux FSCRYPT development
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Eric Biggers <ebiggers@google.com>,
	Andreas Dilger <adilger@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: linux-fscrypt@vger.kernel.org, James Simmons <jsimmons@infradead.org>
Subject: [PATCH 11/18] lnet: socklnd: large processid for ksocknal_get_peer_info
Date: Thu,  9 Jun 2022 08:33:07 -0400	[thread overview]
Message-ID: <1654777994-29806-12-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1654777994-29806-1-git-send-email-jsimmons@infradead.org>

From: Mr NeilBrown <neilb@suse.de>

Have ksocknal_launch_packet() report a 'struct lnet_processid'
with a large address.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: e4a49294530a5d5f7 ("LU-10391 socklnd: large processid for ksocknal_get_peer_info")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/44622
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/klnds/socklnd/socklnd.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/net/lnet/klnds/socklnd/socklnd.c b/net/lnet/klnds/socklnd/socklnd.c
index 2b6fa18..857aa05 100644
--- a/net/lnet/klnds/socklnd/socklnd.c
+++ b/net/lnet/klnds/socklnd/socklnd.c
@@ -292,7 +292,7 @@ struct ksock_peer_ni *
 
 static int
 ksocknal_get_peer_info(struct lnet_ni *ni, int index,
-		       struct lnet_process_id *id, u32 *myip, u32 *peer_ip,
+		       struct lnet_processid *id, u32 *myip, u32 *peer_ip,
 		       int *port, int *conn_count, int *share_count)
 {
 	struct ksock_peer_ni *peer_ni;
@@ -312,8 +312,7 @@ struct ksock_peer_ni *
 			if (index-- > 0)
 				continue;
 
-			id->pid = peer_ni->ksnp_id.pid;
-			id->nid = lnet_nid_to_nid4(&peer_ni->ksnp_id.nid);
+			*id = peer_ni->ksnp_id;
 			*myip = 0;
 			*peer_ip = 0;
 			*port = 0;
@@ -327,8 +326,7 @@ struct ksock_peer_ni *
 			if (index-- > 0)
 				continue;
 
-			id->pid = peer_ni->ksnp_id.pid;
-			id->nid = lnet_nid_to_nid4(&peer_ni->ksnp_id.nid);
+			*id = peer_ni->ksnp_id;
 			*myip = peer_ni->ksnp_passive_ips[j];
 			*peer_ip = 0;
 			*port = 0;
@@ -344,8 +342,7 @@ struct ksock_peer_ni *
 
 			conn_cb = peer_ni->ksnp_conn_cb;
 
-			id->pid = peer_ni->ksnp_id.pid;
-			id->nid = lnet_nid_to_nid4(&peer_ni->ksnp_id.nid);
+			*id = peer_ni->ksnp_id;
 			if (conn_cb->ksnr_addr.ss_family == AF_INET) {
 				struct sockaddr_in *sa;
 
@@ -1808,18 +1805,20 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_processid *id)
 		int share_count = 0;
 
 		rc = ksocknal_get_peer_info(ni, data->ioc_count,
-					    &id4, &myip, &ip, &port,
+					    &id, &myip, &ip, &port,
 					    &conn_count,  &share_count);
 		if (rc)
 			return rc;
 
-		data->ioc_nid = id4.nid;
+		if (!nid_is_nid4(&id.nid))
+			return -EINVAL;
+		data->ioc_nid = lnet_nid_to_nid4(&id.nid);
 		data->ioc_count = share_count;
 		data->ioc_u32[0] = ip;
 		data->ioc_u32[1] = port;
 		data->ioc_u32[2] = myip;
 		data->ioc_u32[3] = conn_count;
-		data->ioc_u32[4] = id4.pid;
+		data->ioc_u32[4] = id.pid;
 		return 0;
 	}
 
-- 
1.8.3.1


  parent reply	other threads:[~2022-06-09 12:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 12:32 [PATCH 00/18] lustre: sync with OpenSFS tree June 8, 2022 James Simmons
2022-06-09 12:32 ` [PATCH 01/18] lustre: llite: reenable fast_read by default James Simmons
2022-06-09 12:32 ` [PATCH 02/18] lustre: llite: Check vmpage in releasepage James Simmons
2022-06-09 12:32 ` [PATCH 03/18] lustre: update version to 2.15.50 James Simmons
2022-06-09 12:33 ` [PATCH 04/18] lustre: llog: read canceled records in llog_backup James Simmons
2022-06-09 12:33 ` [PATCH 05/18] lnet: change LNetPrimaryNID to use struct lnet_nid James Simmons
2022-06-09 12:33 ` [PATCH 06/18] lnet: alter lnet_drop_rule_match() to take lnet_nid James Simmons
2022-06-09 12:33 ` [PATCH 07/18] lnet: Change LNetDist to work with struct lnet_nid James Simmons
2022-06-09 12:33 ` [PATCH 08/18] lnet: convert LNetPut to take 16byte nid and pid James Simmons
2022-06-09 12:33 ` [PATCH 09/18] lnet: change LNetGet " James Simmons
2022-06-09 12:33 ` [PATCH 10/18] lnet: socklnd: pass large processid to ksocknal_add_peer James Simmons
2022-06-09 12:33 ` James Simmons [this message]
2022-06-09 12:33 ` [PATCH 12/18] lnet: socklnd: switch ksocknal_del_peer to lnet_processid James Simmons
2022-06-09 12:33 ` [PATCH 13/18] lustre: llite: access lli_lsm_md with lock in all places James Simmons
2022-06-09 12:33 ` [PATCH 14/18] lustre: quota: fallocate does not increase projectid usage James Simmons
2022-06-09 12:33 ` [PATCH 15/18] lnet: selftest: improve lnet_selftest speed James Simmons
2022-06-09 12:33 ` [PATCH 16/18] lustre: mdc: Use early cancels for hsm requests James Simmons
2022-06-09 12:33 ` [PATCH 17/18] lustre: ptlrpc: send disconnected events James Simmons
2022-06-09 12:33 ` [PATCH 18/18] lnet: Avoid redundant peer NI lookups James Simmons
2022-06-10  0:09 ` [PATCH 00/18] lustre: sync with OpenSFS tree June 8, 2022 Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1654777994-29806-12-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=adilger@whamcloud.com \
    --cc=ebiggers@google.com \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox