[lustre-devel] [PATCH 31/40] lnet: remove crash with UDSP

James Simmons jsimmons at infradead.org
Sun Apr 9 05:13:11 PDT 2023


From: Cyril Bordage <cbordage at whamcloud.com>

The following sequence of commands caused a crash:
  # lnetctl udsp add --dst tcp --prio 1
  # lnetctl discover 192.168.122.60 at tcp
Pointer to lnet_peer_net in udsp_info is checked before used.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15944
Lustre-commit: c56b9455f05f760ae ("LU-15944 lnet: remove crash with UDSP")
Signed-off-by: Cyril Bordage <cbordage at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48801
Reviewed-by: Chris Horn <chris.horn at hpe.com>
Reviewed-by: Serguei Smirnov <ssmirnov at whamcloud.com>
Reviewed-by: Frank Sehr <fsehr at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 net/lnet/lnet/udsp.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/net/lnet/lnet/udsp.c b/net/lnet/lnet/udsp.c
index deaca51..eb9a614 100644
--- a/net/lnet/lnet/udsp.c
+++ b/net/lnet/lnet/udsp.c
@@ -74,13 +74,17 @@
  *     from the policy list.
  *
  *   Generally, the syntax is as follows
- *     lnetctl policy <add | del | show>
- *      --src:      ip2nets syntax specifying the local NID to match
- *      --dst:      ip2nets syntax specifying the remote NID to match
- *      --rte:      ip2nets syntax specifying the router NID to match
- *      --priority: Priority to apply to rule matches
- *      --idx:      Index of where to insert or delete the rule
- *                  By default add appends to the end of the rule list
+ *     lnetctl udsp add: add a udsp
+ *      --src: ip2nets syntax specifying the local NID to match
+ *      --dst: ip2nets syntax specifying the remote NID to match
+ *      --rte: ip2nets syntax specifying the router NID to match
+ *      --priority: priority value (0 - highest priority)
+ *      --idx: index of where to insert the rule.
+ *             By default, appends to the end of the rule list.
+ *     lnetctl udsp del: delete a udsp
+ *      --idx: index of the Policy.
+ *     lnetctl udsp show: show udsps
+ *       --idx: index of the policy to show.
  *
  * Author: Amir Shehata
  */
@@ -536,7 +540,8 @@ enum udsp_apply {
 
 	/* check if looking for a net match */
 	if (!rc &&
-	    (lnet_get_list_len(&lp_match->ud_addr_range) ||
+	    (!udi->udi_lpn ||
+	     lnet_get_list_len(&lp_match->ud_addr_range) ||
 	     !cfs_match_net(udi->udi_lpn->lpn_net_id,
 			    lp_match->ud_net_id.udn_net_type,
 			    &lp_match->ud_net_id.udn_net_num_range))) {
-- 
1.8.3.1



More information about the lustre-devel mailing list