diff mbox series

[11/18] lnet: socklnd: large processid for ksocknal_get_peer_info

Message ID 1654777994-29806-12-git-send-email-jsimmons@infradead.org (mailing list archive)
State Not Applicable
Headers show
Series lustre: sync with OpenSFS tree June 8, 2022 | expand

Commit Message

James Simmons June 9, 2022, 12:33 p.m. UTC
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 mbox series

Patch

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;
 	}