Whamcloud - gitweb
LU-16573 lnet: Check empty list in cfs_match_nid_net 76/50576/2
authorChris Horn <chris.horn@hpe.com>
Fri, 7 Apr 2023 16:46:29 +0000 (10:46 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 22 Apr 2023 17:31:58 +0000 (17:31 +0000)
cfs_match_nid_net() needs to check whether the list of range
expressions describing the address is empty. Otherwise, for numeric
based addresses, we may hit the assert in libcfs_num_match().

Test-Parameters: trivial testlist=sanity-lnet
HPE-bug-id: LUS-11480
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Change-Id: Id2460137607f5564751e729ee7b716d9151b5d37
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50576
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/nidstrings.c
lustre/tests/sanity-lnet.sh

index 09839d9..39c75b2 100644 (file)
@@ -829,11 +829,11 @@ cfs_match_nid_net(struct lnet_nid *nid, __u32 net_type,
        __u32 address;
        struct netstrfns *nf;
 
-       if (!addr || !net_num_list)
+       if (!addr || list_empty(addr) || !net_num_list)
                return 0;
 
        nf = type2net_info(LNET_NETTYP(LNET_NID_NET(nid)));
-       if (!nf || !net_num_list || !addr)
+       if (!nf)
                return 0;
 
        /* FIXME handle long-addr nid */
index 939c629..d7baa3d 100755 (executable)
@@ -3579,6 +3579,19 @@ test_401() {
 }
 run_test 401 "Discover peer after adding peer net UDSP rule"
 
+test_402() {
+       reinit_dlc || return $?
+
+       do_lnetctl udsp add --dst kfi --priority 0 ||
+               error "Failed to add UDSP rule"
+
+       do_lnetctl peer add --prim 402@kfi ||
+               error "Failed to add peer"
+
+       return 0
+}
+run_test 402 "Destination net rule should not panic"
+
 complete $SECONDS
 
 cleanup_testsuite