From patchwork Thu Jun 9 12:33:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12875527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 590D1C433EF for ; Thu, 9 Jun 2022 12:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245532AbiFIMeB (ORCPT ); Thu, 9 Jun 2022 08:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245480AbiFIMds (ORCPT ); Thu, 9 Jun 2022 08:33:48 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E9AC22520 for ; Thu, 9 Jun 2022 05:33:44 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 4B4B6EFA; Thu, 9 Jun 2022 08:33:16 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 498CCD43A0; Thu, 9 Jun 2022 08:33:16 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, James Simmons Subject: [PATCH 11/18] lnet: socklnd: large processid for ksocknal_get_peer_info Date: Thu, 9 Jun 2022 08:33:07 -0400 Message-Id: <1654777994-29806-12-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1654777994-29806-1-git-send-email-jsimmons@infradead.org> References: <1654777994-29806-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Mr NeilBrown 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 Reviewed-on: https://review.whamcloud.com/44622 Reviewed-by: James Simmons Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- 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; }