From f3ba286b05d557b0d8924923eaf8788aa595b1b7 Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Fri, 7 Apr 2023 10:46:29 -0600 Subject: [PATCH] LU-16573 lnet: Check empty list in cfs_match_nid_net 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 Change-Id: Id2460137607f5564751e729ee7b716d9151b5d37 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50576 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Serguei Smirnov Reviewed-by: Frank Sehr Reviewed-by: Cyril Bordage Reviewed-by: Oleg Drokin --- lnet/lnet/nidstrings.c | 4 ++-- lustre/tests/sanity-lnet.sh | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lnet/lnet/nidstrings.c b/lnet/lnet/nidstrings.c index 09839d9..39c75b2 100644 --- a/lnet/lnet/nidstrings.c +++ b/lnet/lnet/nidstrings.c @@ -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 */ diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index 939c629..d7baa3d 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -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 -- 1.8.3.1